Skip to content

Commit

Permalink
fix base.py expansion of None
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-codecov committed Aug 17, 2023
1 parent 6be055d commit 305e9e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tasks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,15 @@ def apply_async(self, args=None, kwargs=None, **options):
"soft_time_limit": extra_config.get("soft_timelimit", None),
}
options = {**options, **celery_compatible_config}

opt_headers = options.pop("headers", {})
opt_headers = opt_headers if opt_headers is not None else {}

# Pass current time in task headers so we can emit a metric of
# how long the task was in the queue for
current_time = datetime.now()
headers = {
**options.pop("headers", {}),
**opt_headers,
"created_timestamp": current_time.isoformat(),
}
return super().apply_async(args=args, kwargs=kwargs, headers=headers, **options)
Expand Down

0 comments on commit 305e9e8

Please sign in to comment.