mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-06 12:41:31 +08:00
fix(lint): resolve pylint warnings in ctl/server and gtornado
- Replace global statement with module-level dict in ctl/server.py - Fix argument rename warning in gtornado.py nested class method
This commit is contained in:
parent
089ad45818
commit
474f3ffa1e
@ -31,15 +31,14 @@ from gunicorn.ctl.protocol import (
|
|||||||
# Module-level tracking of active control server instances for fork handling.
|
# Module-level tracking of active control server instances for fork handling.
|
||||||
# This is necessary because os.register_at_fork() callbacks are process-level.
|
# This is necessary because os.register_at_fork() callbacks are process-level.
|
||||||
_active_servers = set()
|
_active_servers = set()
|
||||||
_fork_handlers_registered = False
|
_module_state = {"fork_handlers_registered": False}
|
||||||
|
|
||||||
|
|
||||||
def _register_fork_handlers():
|
def _register_fork_handlers():
|
||||||
"""Register fork handlers once at module level."""
|
"""Register fork handlers once at module level."""
|
||||||
global _fork_handlers_registered
|
if _module_state["fork_handlers_registered"]:
|
||||||
if _fork_handlers_registered:
|
|
||||||
return
|
return
|
||||||
_fork_handlers_registered = True
|
_module_state["fork_handlers_registered"] = True
|
||||||
|
|
||||||
os.register_at_fork(
|
os.register_at_fork(
|
||||||
before=_before_fork,
|
before=_before_fork,
|
||||||
|
|||||||
@ -98,10 +98,12 @@ class TornadoWorker(Worker):
|
|||||||
not isinstance(app, tornado.web.Application):
|
not isinstance(app, tornado.web.Application):
|
||||||
app = WSGIContainer(app)
|
app = WSGIContainer(app)
|
||||||
|
|
||||||
|
worker = self
|
||||||
|
|
||||||
class _HTTPServer(tornado.httpserver.HTTPServer):
|
class _HTTPServer(tornado.httpserver.HTTPServer):
|
||||||
|
|
||||||
def on_close(instance, server_conn):
|
def on_close(self, server_conn):
|
||||||
self.handle_request()
|
worker.handle_request()
|
||||||
super().on_close(server_conn)
|
super().on_close(server_conn)
|
||||||
|
|
||||||
if self.cfg.is_ssl:
|
if self.cfg.is_ssl:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user