mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-02 18:51:31 +08:00
fix: resolve lint issues in dirty arbiter modules
This commit is contained in:
parent
77222b8017
commit
21f769ce16
@ -16,7 +16,6 @@ import signal
|
|||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import traceback
|
|
||||||
|
|
||||||
from gunicorn import util
|
from gunicorn import util
|
||||||
|
|
||||||
@ -357,7 +356,7 @@ class DirtyArbiter:
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception:
|
||||||
self.log.exception("Exception in dirty worker process")
|
self.log.exception("Exception in dirty worker process")
|
||||||
if not worker.booted:
|
if not worker.booted:
|
||||||
sys.exit(self.WORKER_BOOT_ERROR)
|
sys.exit(self.WORKER_BOOT_ERROR)
|
||||||
|
|||||||
@ -125,7 +125,7 @@ class DirtyClient:
|
|||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
self._close_socket()
|
self._close_socket()
|
||||||
raise DirtyTimeoutError(
|
raise DirtyTimeoutError(
|
||||||
f"Timeout waiting for dirty app response",
|
"Timeout waiting for dirty app response",
|
||||||
timeout=self.timeout
|
timeout=self.timeout
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -238,7 +238,7 @@ class DirtyClient:
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
await self._close_async()
|
await self._close_async()
|
||||||
raise DirtyTimeoutError(
|
raise DirtyTimeoutError(
|
||||||
f"Timeout waiting for dirty app response",
|
"Timeout waiting for dirty app response",
|
||||||
timeout=self.timeout
|
timeout=self.timeout
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -12,7 +12,6 @@ from the DirtyArbiter.
|
|||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
import sys
|
|
||||||
import traceback
|
import traceback
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@ -214,7 +213,6 @@ class DirtyWorker:
|
|||||||
|
|
||||||
Each connection can send multiple requests.
|
Each connection can send multiple requests.
|
||||||
"""
|
"""
|
||||||
addr = writer.get_extra_info('peername')
|
|
||||||
self.log.debug("New connection from arbiter")
|
self.log.debug("New connection from arbiter")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
"""Tests for dirty client module."""
|
"""Tests for dirty client module."""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import tempfile
|
import tempfile
|
||||||
@ -17,7 +16,6 @@ from gunicorn.dirty.client import (
|
|||||||
get_dirty_socket_path,
|
get_dirty_socket_path,
|
||||||
set_dirty_socket_path,
|
set_dirty_socket_path,
|
||||||
close_dirty_client,
|
close_dirty_client,
|
||||||
_thread_local,
|
|
||||||
)
|
)
|
||||||
from gunicorn.dirty.errors import DirtyConnectionError, DirtyError
|
from gunicorn.dirty.errors import DirtyConnectionError, DirtyError
|
||||||
from gunicorn.dirty.protocol import DirtyProtocol, make_response
|
from gunicorn.dirty.protocol import DirtyProtocol, make_response
|
||||||
|
|||||||
@ -155,7 +155,6 @@ class TestDirtyExecutionTimeout:
|
|||||||
import tempfile
|
import tempfile
|
||||||
from gunicorn.dirty.arbiter import DirtyArbiter
|
from gunicorn.dirty.arbiter import DirtyArbiter
|
||||||
from gunicorn.dirty.protocol import DirtyProtocol, make_request
|
from gunicorn.dirty.protocol import DirtyProtocol, make_request
|
||||||
from gunicorn.dirty.errors import DirtyTimeoutError
|
|
||||||
|
|
||||||
class MockLog:
|
class MockLog:
|
||||||
def debug(self, *a, **kw): pass
|
def debug(self, *a, **kw): pass
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
"""Tests for dirty arbiter protocol module."""
|
"""Tests for dirty arbiter protocol module."""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import os
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
import pytest
|
import pytest
|
||||||
@ -183,7 +184,7 @@ class TestDirtyProtocolAsync:
|
|||||||
read_fd, write_fd = os.pipe()
|
read_fd, write_fd = os.pipe()
|
||||||
try:
|
try:
|
||||||
reader = asyncio.StreamReader()
|
reader = asyncio.StreamReader()
|
||||||
protocol = asyncio.StreamReaderProtocol(reader)
|
_ = asyncio.StreamReaderProtocol(reader)
|
||||||
|
|
||||||
# Write the message to the pipe
|
# Write the message to the pipe
|
||||||
encoded = DirtyProtocol.encode(message)
|
encoded = DirtyProtocol.encode(message)
|
||||||
@ -369,7 +370,3 @@ class TestDirtyErrors:
|
|||||||
assert error.action == "run"
|
assert error.action == "run"
|
||||||
assert error.traceback == "Traceback..."
|
assert error.traceback == "Traceback..."
|
||||||
assert "myapp:App" in str(error)
|
assert "myapp:App" in str(error)
|
||||||
|
|
||||||
|
|
||||||
# Add import needed for async tests
|
|
||||||
import os
|
|
||||||
|
|||||||
@ -662,8 +662,6 @@ class TestDirtyWorkerRunAsync:
|
|||||||
reader.feed_data(encoded_request)
|
reader.feed_data(encoded_request)
|
||||||
reader.feed_eof()
|
reader.feed_eof()
|
||||||
|
|
||||||
responses = []
|
|
||||||
|
|
||||||
class MockWriter:
|
class MockWriter:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.closed = False
|
self.closed = False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user