mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-02 18:51:31 +08:00
fix(dirty): resolve pylint warnings in dirty module
This commit is contained in:
parent
cc39ed922e
commit
634290fc75
@ -89,7 +89,6 @@ class DirtyApp:
|
|||||||
This method is called in the child process after fork, so it's
|
This method is called in the child process after fork, so it's
|
||||||
safe to initialize non-fork-safe resources here.
|
safe to initialize non-fork-safe resources here.
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
def __call__(self, action, *args, **kwargs):
|
def __call__(self, action, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
@ -119,7 +118,6 @@ class DirtyApp:
|
|||||||
Called when the dirty worker is shutting down. Use this to
|
Called when the dirty worker is shutting down. Use this to
|
||||||
release resources like database connections, unload models, etc.
|
release resources like database connections, unload models, etc.
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def load_dirty_app(import_path):
|
def load_dirty_app(import_path):
|
||||||
|
|||||||
@ -412,7 +412,7 @@ class DirtyArbiter:
|
|||||||
def _close_worker_connection(self, worker_pid):
|
def _close_worker_connection(self, worker_pid):
|
||||||
"""Close connection to a worker."""
|
"""Close connection to a worker."""
|
||||||
if worker_pid in self.worker_connections:
|
if worker_pid in self.worker_connections:
|
||||||
reader, writer = self.worker_connections.pop(worker_pid)
|
_reader, writer = self.worker_connections.pop(worker_pid)
|
||||||
writer.close()
|
writer.close()
|
||||||
|
|
||||||
async def manage_workers(self):
|
async def manage_workers(self):
|
||||||
|
|||||||
@ -447,13 +447,12 @@ class DirtyStreamIterator:
|
|||||||
"Stream exceeded total timeout",
|
"Stream exceeded total timeout",
|
||||||
timeout=self.client.timeout
|
timeout=self.client.timeout
|
||||||
)
|
)
|
||||||
else:
|
idle_duration = now - self._last_chunk_time
|
||||||
idle_duration = now - self._last_chunk_time
|
self._exhausted = True
|
||||||
self._exhausted = True
|
raise DirtyTimeoutError(
|
||||||
raise DirtyTimeoutError(
|
f"Timeout waiting for next chunk (idle {idle_duration:.1f}s)",
|
||||||
f"Timeout waiting for next chunk (idle {idle_duration:.1f}s)",
|
timeout=self._idle_timeout
|
||||||
timeout=self._idle_timeout
|
)
|
||||||
)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._exhausted = True
|
self._exhausted = True
|
||||||
self.client._close_socket()
|
self.client._close_socket()
|
||||||
@ -599,12 +598,11 @@ class DirtyAsyncStreamIterator:
|
|||||||
"Stream exceeded total timeout",
|
"Stream exceeded total timeout",
|
||||||
timeout=self.client.timeout
|
timeout=self.client.timeout
|
||||||
)
|
)
|
||||||
else:
|
idle_duration = now - self._last_chunk_time
|
||||||
idle_duration = now - self._last_chunk_time
|
raise DirtyTimeoutError(
|
||||||
raise DirtyTimeoutError(
|
f"Timeout waiting for next chunk (idle {idle_duration:.1f}s)",
|
||||||
f"Timeout waiting for next chunk (idle {idle_duration:.1f}s)",
|
timeout=self._idle_timeout
|
||||||
timeout=self._idle_timeout
|
)
|
||||||
)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._exhausted = True
|
self._exhausted = True
|
||||||
await self.client._close_async()
|
await self.client._close_async()
|
||||||
@ -658,7 +656,7 @@ _dirty_socket_path = None
|
|||||||
|
|
||||||
def set_dirty_socket_path(path):
|
def set_dirty_socket_path(path):
|
||||||
"""Set the global dirty socket path (called during initialization)."""
|
"""Set the global dirty socket path (called during initialization)."""
|
||||||
global _dirty_socket_path
|
global _dirty_socket_path # pylint: disable=global-statement
|
||||||
_dirty_socket_path = path
|
_dirty_socket_path = path
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user