import os
import sys
import traceback

import gunicorn
from gds_metrics.gunicorn import child_exit  # noqa

workers = 5
worker_class = "eventlet"
errorlog = "/home/vcap/logs/gunicorn_error.log"
bind = "0.0.0.0:{}".format(os.getenv("PORT"))
disable_redirect_access_to_syslog = True
gunicorn.SERVER_SOFTWARE = 'None'


def worker_abort(worker):
    worker.log.info("worker received ABORT")
    for stack in sys._current_frames().values():
        worker.log.error(''.join(traceback.format_stack(stack)))

@@ -30,16 +30,46 @@
 raceback
+%0Aimport eventlet%0Aimport socket
 %0A%0Aimport
@@ -525,8 +525,875 @@
 tack)))%0A
+%0A%0Adef fix_ssl_monkeypatching():%0A    %22%22%22%0A    eventlet works by monkey-patching core IO libraries (such as ssl) to be non-blocking. However, there's currently%0A    a bug: In the normal socket library it may throw a timeout error as a %60socket.timeout%60 exception. However%0A    eventlet.green.ssl's patch raises an ssl.SSLError('timed out',) instead. redispy handles socket.timeout but not%0A    ssl.SSLError, so we solve this by monkey patching the monkey patching code to raise the correct exception type%0A    :scream:%0A    https://github.com/eventlet/eventlet/issues/692%0A    %22%22%22%0A    # this has probably already been called somewhere in gunicorn internals, however, to be sure, we invoke it again.%0A    # eventlet.monkey_patch can be called multiple times without issue%0A    eventlet.monkey_patch()%0A    eventlet.green.ssl.timeout_exc = socket.timeout%0A%0A%0Afix_ssl_monkeypatching()%0A

Fix rediss ssl eventlet sslerror bug