Merge "Use socket_timeout kwarg instead of useless eventlet.wsgi.WRITE_TIMEOUT"

This commit is contained in:
Zuul 2020-11-18 02:19:01 +00:00 committed by Gerrit Code Review
commit ebfc3a61fa
6 changed files with 10 additions and 14 deletions

View File

@ -76,7 +76,7 @@ bind_port = 6200
# container_update_timeout = 1.0
# Time to wait while receiving each chunk of data from a client or another
# backend node.
# client_timeout = 60
# client_timeout = 60.0
#
# network_chunk_size = 65536
# disk_chunk_size = 65536

View File

@ -85,7 +85,7 @@ bind_port = 8080
# CORS documentation).
# cors_expose_headers =
#
# client_timeout = 60
# client_timeout = 60.0
# eventlet_debug = false
#
# You can set scheduling priority of processes. Niceness values range from -20

View File

@ -642,8 +642,6 @@ def run_server(conf, logger, sock, global_conf=None, ready_callback=None):
os.environ['TZ'] = 'UTC+0'
time.tzset()
wsgi.WRITE_TIMEOUT = int(conf.get('client_timeout') or 60)
eventlet.hubs.use_hub(get_hub())
eventlet_debug = config_true_value(conf.get('eventlet_debug', 'no'))
eventlet.debug.hub_exceptions(eventlet_debug)
@ -672,6 +670,7 @@ def run_server(conf, logger, sock, global_conf=None, ready_callback=None):
server_kwargs = {
'custom_pool': pool,
'protocol': protocol_class,
'socket_timeout': float(conf.get('client_timeout') or 60),
# Disable capitalizing headers in Eventlet. This is necessary for
# the AWS SDK to work with s3api middleware (it needs an "ETag"
# header; "Etag" just won't do).

View File

@ -145,7 +145,7 @@ class ObjectController(BaseStorageServer):
self.container_update_timeout = float(
conf.get('container_update_timeout', 1))
self.conn_timeout = float(conf.get('conn_timeout', 0.5))
self.client_timeout = int(conf.get('client_timeout', 60))
self.client_timeout = float(conf.get('client_timeout', 60))
self.disk_chunk_size = int(conf.get('disk_chunk_size', 65536))
self.network_chunk_size = int(conf.get('network_chunk_size', 65536))
self.log_requests = config_true_value(conf.get('log_requests', 'true'))

View File

@ -647,9 +647,6 @@ def in_process_setup(the_object_server=object_server):
'port': con2lis.getsockname()[1]}], 30),
f)
# Default to only 4 seconds for in-process functional test runs
eventlet.wsgi.WRITE_TIMEOUT = 4
def get_logger_name(name):
if show_debug_logs:
return debug_logger(name)

View File

@ -467,7 +467,6 @@ class TestWSGI(unittest.TestCase):
logger = logging.getLogger('test')
sock = listen_zero()
wsgi.run_server(conf, logger, sock)
self.assertEqual(30, _wsgi.WRITE_TIMEOUT)
_wsgi_evt.hubs.use_hub.assert_called_with(utils.get_hub())
_wsgi_evt.debug.hub_exceptions.assert_called_with(False)
self.assertTrue(_wsgi.server.called)
@ -479,6 +478,7 @@ class TestWSGI(unittest.TestCase):
self.assertTrue(isinstance(server_logger, wsgi.NullLogger))
self.assertTrue('custom_pool' in kwargs)
self.assertEqual(1000, kwargs['custom_pool'].size)
self.assertEqual(30, kwargs['socket_timeout'])
proto_class = kwargs['protocol']
self.assertEqual(proto_class, wsgi.SwiftHttpProtocol)
@ -497,7 +497,7 @@ class TestWSGI(unittest.TestCase):
[app:proxy-server]
use = egg:swift#proxy
# these "set" values override defaults
set client_timeout = 20
set client_timeout = 2.5
set max_clients = 10
require_proxy_protocol = true
"""
@ -517,7 +517,6 @@ class TestWSGI(unittest.TestCase):
logger = logging.getLogger('test')
sock = listen_zero()
wsgi.run_server(conf, logger, sock)
self.assertEqual(20, _wsgi.WRITE_TIMEOUT)
_eventlet.hubs.use_hub.assert_called_with(utils.get_hub())
_eventlet.debug.hub_exceptions.assert_called_with(False)
self.assertTrue(_wsgi.server.called)
@ -525,10 +524,11 @@ class TestWSGI(unittest.TestCase):
server_sock, server_app, server_logger = args
self.assertEqual(sock, server_sock)
self.assertTrue(isinstance(server_app, swift.proxy.server.Application))
self.assertEqual(20, server_app.client_timeout)
self.assertEqual(2.5, server_app.client_timeout)
self.assertTrue(isinstance(server_logger, wsgi.NullLogger))
self.assertTrue('custom_pool' in kwargs)
self.assertEqual(10, kwargs['custom_pool'].size)
self.assertEqual(2.5, kwargs['socket_timeout'])
proto_class = kwargs['protocol']
self.assertEqual(proto_class, wsgi.SwiftHttpProxiedProtocol)
@ -602,7 +602,6 @@ class TestWSGI(unittest.TestCase):
wsgi.run_server(conf, logger, sock)
self.assertNotEqual(os.environ['TZ'], '')
self.assertEqual(30, _wsgi.WRITE_TIMEOUT)
_wsgi_evt.hubs.use_hub.assert_called_with(utils.get_hub())
_wsgi_evt.debug.hub_exceptions.assert_called_with(False)
self.assertTrue(_wsgi.server.called)
@ -612,6 +611,7 @@ class TestWSGI(unittest.TestCase):
self.assertTrue(isinstance(server_app, swift.proxy.server.Application))
self.assertTrue(isinstance(server_logger, wsgi.NullLogger))
self.assertTrue('custom_pool' in kwargs)
self.assertEqual(30, kwargs['socket_timeout'])
self.assertTrue('protocol' in kwargs)
self.assertEqual('HTTP/1.0',
kwargs['protocol'].default_request_version)
@ -652,7 +652,6 @@ class TestWSGI(unittest.TestCase):
logger = logging.getLogger('test')
sock = listen_zero()
wsgi.run_server(conf, logger, sock)
self.assertEqual(30, _wsgi.WRITE_TIMEOUT)
_wsgi_evt.hubs.use_hub.assert_called_with(utils.get_hub())
_wsgi_evt.debug.hub_exceptions.assert_called_with(True)
self.assertTrue(mock_server.called)
@ -664,6 +663,7 @@ class TestWSGI(unittest.TestCase):
self.assertIsNone(server_logger)
self.assertTrue('custom_pool' in kwargs)
self.assertEqual(1000, kwargs['custom_pool'].size)
self.assertEqual(30, kwargs['socket_timeout'])
self.assertTrue('protocol' in kwargs)
self.assertEqual('HTTP/1.0',
kwargs['protocol'].default_request_version)