Skip to content

Commit

Permalink
Close old django connections before task body.
Browse files Browse the repository at this point in the history
Replaces /refs #633
  • Loading branch information
coleifer committed Nov 12, 2021
1 parent 3ce5e6d commit e77acf3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions huey/contrib/djhuey/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def close_db(fn):
"""Decorator to be used with tasks that may operate on the database."""
@wraps(fn)
def inner(*args, **kwargs):
if not HUEY.immediate:
close_old_connections()
try:
return fn(*args, **kwargs)
finally:
Expand Down

0 comments on commit e77acf3

Please sign in to comment.