|
20 | 20 | cast,
|
21 | 21 | )
|
22 | 22 |
|
| 23 | +from ...common.flag import flags as proxy_flags |
23 | 24 | from ...common.types import Readables, Writables, SelectableEvents
|
24 | 25 | from ...common.logger import Logger
|
25 | 26 | from ...common.constants import (
|
|
37 | 38 | logger = logging.getLogger(__name__)
|
38 | 39 |
|
39 | 40 |
|
| 41 | +proxy_flags.add_argument( |
| 42 | + '--inactive-conn-cleanup-timeout', |
| 43 | + default=DEFAULT_INACTIVE_CONN_CLEANUP_TIMEOUT, |
| 44 | + help='Time after which inactive works must be cleaned up. ' |
| 45 | + + 'Increase this value if your backend services are slow to response ' |
| 46 | + + 'or when proxy.py is handling a high volume. When running proxy.py on Google Cloud (GCP) ' |
| 47 | + + "you may see 'backend_connection_closed_before_data_sent_to_client', with curl clients " |
| 48 | + + "you may see 'Empty reply from server' error when '--inactive-conn-cleanup-timeout' " |
| 49 | + + 'value is low for your use-case. Default {0} seconds'.format( |
| 50 | + DEFAULT_INACTIVE_CONN_CLEANUP_TIMEOUT, |
| 51 | + ), |
| 52 | +) |
| 53 | + |
| 54 | + |
40 | 55 | class Threadless(ABC, Generic[T]):
|
41 | 56 | """Work executor base class.
|
42 | 57 |
|
@@ -87,7 +102,7 @@ def __init__(
|
87 | 102 | SelectableEvents,
|
88 | 103 | ] = {}
|
89 | 104 | self.wait_timeout: float = DEFAULT_WAIT_FOR_TASKS_TIMEOUT
|
90 |
| - self.cleanup_inactive_timeout: float = DEFAULT_INACTIVE_CONN_CLEANUP_TIMEOUT |
| 105 | + self.cleanup_inactive_timeout: float = self.flags.inactive_conn_cleanup_timeout |
91 | 106 | self._total: int = 0
|
92 | 107 | # When put at the top, causes circular import error
|
93 | 108 | # since integrated ssh tunnel was introduced.
|
|
0 commit comments