Skip to content

Commit

Permalink
drop task from the cache at the beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
lcouzens committed Jun 26, 2024
1 parent 8c63a37 commit f8ef815
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions koku/masu/processor/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,9 +852,11 @@ def update_cost_model_costs(
"""
task_name = "masu.processor.tasks.update_cost_model_costs"
cache_args = [schema_name, provider_uuid, start_date, end_date]
# Remove queued task from cache
worker_cache = WorkerCache()
cache_key = f"{provider_uuid}:{start_date}:{end_date}"
worker_cache.remove_task_from_cache(cache_key)
cache_args = [schema_name, provider_uuid, start_date, end_date]
if not synchronous:
fallback_queue = get_customer_queue(schema_name, CostModelQueue)
if worker_cache.single_task_is_running(task_name, cache_args):
Expand Down Expand Up @@ -890,14 +892,11 @@ def update_cost_model_costs(
except Exception as ex:
if not synchronous:
worker_cache.release_single_task(task_name, cache_args)
worker_cache.remove_task_from_cache(cache_key)
raise ex

if not synchronous:
worker_cache.release_single_task(task_name, cache_args)

worker_cache.remove_task_from_cache(cache_key)


@celery_app.task(name="masu.processor.tasks.mark_manifest_complete", queue=PriorityQueue.DEFAULT)
def mark_manifest_complete(
Expand Down

0 comments on commit f8ef815

Please sign in to comment.