fix flake8 linelength errors

This commit is contained in:
Alec Buckenheimer 2018-10-01 09:46:18 -04:00
parent efbacc17cf
commit 9a08bdae4a
2 changed files with 18 additions and 12 deletions

View File

@ -147,18 +147,23 @@ if base is not None:
self.notify() self.notify()
req_count = sum( req_count = sum(
self.servers[srv]["requests_count"] for srv in self.servers srv['requests_count'] for srv in self.servers.values()
) )
if self.max_requests and req_count > self.max_requests: if self.max_requests and req_count > self.max_requests:
self.alive = False self.alive = False
self.log.info("Max requests exceeded, shutting down: %s", self.log.info(
self) "Max requests exceeded, shutting down: %s",
self
)
elif pid == os.getpid() and self.ppid != os.getppid(): elif pid == os.getpid() and self.ppid != os.getppid():
self.alive = False self.alive = False
self.log.info("Parent changed, shutting down: %s", self) self.log.info(
"Parent changed, shutting down: %s",
self
)
else: else:
await asyncio.sleep(1.0, loop=self.loop) await asyncio.sleep(1.0, loop=self.loop)
except (Exception, BaseException, GeneratorExit, KeyboardInterrupt): except (BaseException, GeneratorExit, KeyboardInterrupt):
pass pass
@staticmethod @staticmethod

View File

@ -173,33 +173,34 @@ def test_route_strict_slashes_set_to_false_and_host_is_a_list(app):
# before fix, this raises a RouteExists error # before fix, this raises a RouteExists error
@app.get('/get', host=[site1, 'site2.com'], strict_slashes=False) @app.get('/get', host=[site1, 'site2.com'], strict_slashes=False)
def handler(request): def get_handler(request):
return text('OK') return text('OK')
request, response = app.test_client.get('http://' + site1 + '/get') request, response = app.test_client.get('http://' + site1 + '/get')
assert response.text == 'OK' assert response.text == 'OK'
@app.post('/post', host=[site1, 'site2.com'], strict_slashes=False) # noqa @app.post('/post', host=[site1, 'site2.com'], strict_slashes=False)
def handler(request): def post_handler(request):
return text('OK') return text('OK')
request, response = app.test_client.post('http://' + site1 + '/post') request, response = app.test_client.post('http://' + site1 + '/post')
assert response.text == 'OK' assert response.text == 'OK'
@app.put('/put', host=[site1, 'site2.com'], strict_slashes=False) # noqa @app.put('/put', host=[site1, 'site2.com'], strict_slashes=False)
def handler(request): def put_handler(request):
return text('OK') return text('OK')
request, response = app.test_client.put('http://' + site1 + '/put') request, response = app.test_client.put('http://' + site1 + '/put')
assert response.text == 'OK' assert response.text == 'OK'
@app.delete('/delete', host=[site1, 'site2.com'], strict_slashes=False) # noqa @app.delete('/delete', host=[site1, 'site2.com'], strict_slashes=False)
def handler(request): def delete_handler(request):
return text('OK') return text('OK')
request, response = app.test_client.delete('http://' + site1 + '/delete') request, response = app.test_client.delete('http://' + site1 + '/delete')
assert response.text == 'OK' assert response.text == 'OK'
def test_shorthand_routes_post(app): def test_shorthand_routes_post(app):
@app.post('/post') @app.post('/post')