def postcommit_after_request(response, base_status_error_code=500):
    if response.status_code >= base_status_error_code:
        _local.postcommit_queue = set()
        return response
    try:
        if settings.ENABLE_VARNISH and postcommit_queue():
            import gevent
            threads = [gevent.spawn(func, *args) for func, args in postcommit_queue()]
            gevent.joinall(threads)
    except __HOLE__:
        if not settings.DEBUG_MODE:
            logger.error('Post commit task queue not initialized')
    return response
dataset/ETHPy150Open CenterForOpenScience/osf.io/framework/postcommit_tasks/handlers.py/postcommit_after_request