CFY-1222 only update exit hook when running inside a celery worker