diff --git a/inventory_provider/routes/jobs.py b/inventory_provider/routes/jobs.py index 9a8080c87a48174a27fcc50935b585ed738961a7..fc07171113483ca7af59850b8af23ec98dcf1f1b 100644 --- a/inventory_provider/routes/jobs.py +++ b/inventory_provider/routes/jobs.py @@ -23,9 +23,10 @@ def update(): force = False config = current_app.config['INVENTORY_PROVIDER_CONFIG'] + r = get_current_redis(config) if not force: - latch = get_latch(get_current_redis(config)) + latch = get_latch(r) if latch and latch['pending']: return Response( response='an update is already in progress', @@ -34,7 +35,6 @@ def update(): phase2_task_id = worker.launch_refresh_cache_all(config) - r = common.get_current_redis() r.set('classifier-cache:update-task-id', phase2_task_id.encode('utf-8')) return jsonify({'task id': phase2_task_id})