Skip to content

Commit 885f08c

Browse files
committed
fix: undefined name 'ChordCounter' and minor fixes
1 parent 3591140 commit 885f08c

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:
@@ -258,7 +262,9 @@ def on_chord_part_return(self, request, state, result, **kwargs):
258262
if not gid or not tid:
259263
return
260264
call_callback = False
261-
with transaction.atomic(using=router.db_for_write(ChordCounter)):
265+
with transaction.atomic(
266+
using=router.db_for_write(self.ChordCounterModel)
267+
):
262268
# We need to know if `count` hits 0.
263269
# wrap the update in a transaction
264270
# 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)