Skip to content

Commit 946ff07

Browse files
committed
fix: undefined name 'ChordCounter' and minor fixes
1 parent d6b0d19 commit 946ff07

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

django_celery_results/backends/database.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
from django.db.utils import InterfaceError
1313
from kombu.exceptions import DecodeError
1414

15-
from ..models.helpers import chordcounter_model, groupresult_model, taskresult_model
15+
from ..models.helpers import (
16+
chordcounter_model,
17+
groupresult_model,
18+
taskresult_model,
19+
)
1620
from ..settings import get_task_props_extension
1721

1822
EXCEPTIONS_TO_CATCH = (InterfaceError,)
@@ -81,7 +85,7 @@ def _get_extended_properties(self, request, traceback):
8185
task_kwargs = getattr(request, 'kwargs', None)
8286

8387
# TODO: We assume that task protocol 1 could be always in use. :/
84-
extra_fields = extend_task_props_callback(
88+
extra_fields = get_task_props_extension(
8589
getattr(request, 'kwargs', None)
8690
)
8791
if extra_fields:
@@ -256,7 +260,9 @@ def on_chord_part_return(self, request, state, result, **kwargs):
256260
if not gid or not tid:
257261
return
258262
call_callback = False
259-
with transaction.atomic(using=router.db_for_write(ChordCounter)):
263+
with transaction.atomic(
264+
using=router.db_for_write(self.ChordCounterModel)
265+
):
260266
# We need to know if `count` hits 0.
261267
# wrap the update in a transaction
262268
# with a `select_for_update` lock to prevent race conditions.

django_celery_results/models/generic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Database models."""
22

3-
from django.utils.translation import gettext_lazy as _
4-
53
from django_celery_results.models.abstract import (
64
AbstractChordCounter,
75
AbstractGroupResult,

0 commit comments

Comments
 (0)