MCPcopy
hub / github.com/benoitc/gunicorn / run

Method run

gunicorn/dirty/worker.py:227–247  ·  view source on GitHub ↗

Run the main asyncio event loop.

(self)

Source from the content-addressed store, hash-verified

225 raise
226
227 def run(self):
228 """Run the main asyncio event loop."""
229 # Lazy import for gevent compatibility (see #3482)
230 from concurrent.futures import ThreadPoolExecutor
231
232 # Create thread pool for executing app actions
233 num_threads = self.cfg.dirty_threads
234 self._executor = ThreadPoolExecutor(
235 max_workers=num_threads,
236 thread_name_prefix=f"dirty-worker-{self.pid}-"
237 )
238 self.log.debug("Created thread pool with %d threads", num_threads)
239
240 try:
241 self._loop = asyncio.new_event_loop()
242 asyncio.set_event_loop(self._loop)
243 self._loop.run_until_complete(self._run_async())
244 except Exception as e:
245 self.log.error("Worker error: %s", e)
246 finally:
247 self._cleanup()
248
249 async def _run_async(self):
250 """Main async loop - start server and handle connections."""

Callers 3

init_processMethod · 0.95

Calls 4

_run_asyncMethod · 0.95
_cleanupMethod · 0.95
debugMethod · 0.45
errorMethod · 0.45

Tested by 2