mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-30 19:08:33 -04:00
fix minor startup error
This commit is contained in:
@@ -52,7 +52,8 @@ def cleanup_unfinished_jobs():
|
||||
# The query already checks that the processing_finished time is null, so here we are saying
|
||||
# if it started more than 4 hours ago, that's too long
|
||||
try:
|
||||
acceptable_finish_time = job.processing_started + timedelta(minutes=5)
|
||||
if job.processing_started is not None:
|
||||
acceptable_finish_time = job.processing_started + timedelta(minutes=5)
|
||||
except TypeError:
|
||||
current_app.logger.exception(
|
||||
f"Job ID {job.id} processing_started is {job.processing_started}.",
|
||||
|
||||
@@ -16,6 +16,18 @@ gunicorn.SERVER_SOFTWARE = "None"
|
||||
|
||||
def on_starting(server):
|
||||
server.log.info("Starting Notifications API")
|
||||
from gunicorn.http.wsgi import Response
|
||||
|
||||
original_init = Response.__init__
|
||||
|
||||
def custom_init(self, *args, **kwargs):
|
||||
original_init(self, *args, **kwargs)
|
||||
self.headers = [
|
||||
(key, value) for key, value in self.headers if key.lower() != "server"
|
||||
]
|
||||
print(f"HEADERS {self.headers}")
|
||||
|
||||
Response.__init__ = custom_init
|
||||
|
||||
|
||||
def worker_abort(worker):
|
||||
@@ -32,23 +44,6 @@ def worker_int(worker):
|
||||
worker.log.info("worker: received SIGINT {}".format(worker.pid))
|
||||
|
||||
|
||||
# fix dynamic scan warning 10036
|
||||
def post_fork(server, worker):
|
||||
server.cfg.set(
|
||||
"secure_scheme_headers",
|
||||
{
|
||||
"X-FORWARDED-PROTO": "https",
|
||||
},
|
||||
)
|
||||
original_send = worker.wsgi.send
|
||||
|
||||
def custom_send(self, resp, *args, **kwargs):
|
||||
resp.headers.pop("Server", None)
|
||||
return original_send(resp, *args, **kwargs)
|
||||
|
||||
worker.wsgi.send = custom_send.__get__(worker.wsgi, type(worker.wsgi))
|
||||
|
||||
|
||||
def fix_ssl_monkeypatching():
|
||||
"""
|
||||
eventlet works by monkey-patching core IO libraries (such as ssl) to be non-blocking. However, there's currently
|
||||
|
||||
Reference in New Issue
Block a user