Skip to content

Commit 101a24f

Browse files
committed
fix: TypeError introducedn on prev commit on 'AbstractChordCounter'
1 parent c508179 commit 101a24f

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

django_celery_results/backends/database.py

Lines changed: 5 additions & 1 deletion
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,)

django_celery_results/models/abstract.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
import json
44

55
from celery import states
6-
from celery.result import result_from_tuple
6+
from celery.result import CeleryGroupResult, result_from_tuple
77
from django.conf import settings
88
from django.db import models
99
from django.utils.translation import gettext_lazy as _
1010

1111
from .. import managers
12-
from ..models.helpers import groupresult_model
1312

1413
ALL_STATES = sorted(states.ALL_STATES)
1514
TASK_STATE_CHOICES = sorted(zip(ALL_STATES, ALL_STATES))
@@ -174,7 +173,7 @@ def group_result(self, app=None):
174173
app (Celery): app instance to create the GroupResult with.
175174
176175
"""
177-
return groupresult_model()(
176+
return CeleryGroupResult(
178177
self.group_id,
179178
[result_from_tuple(r, app=app)
180179
for r in json.loads(self.sub_tasks)],

django_celery_results/models/helpers.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
from django.conf import settings
33
from django.core.exceptions import ImproperlyConfigured
44

5+
from .generic import ChordCounter, GroupResult, TaskResult
6+
57

68
def taskresult_model():
79
"""Return the TaskResult model that is active in this project."""
810
if not hasattr(settings, 'CELERY_RESULTS_TASKRESULT_MODEL'):
9-
from .generic import TaskResult
10-
1111
return TaskResult
1212

1313
try:
@@ -31,8 +31,6 @@ def chordcounter_model():
3131
"""Return the ChordCounter model that is active in this project."""
3232

3333
if not hasattr(settings, 'CELERY_RESULTS_CHORDCOUNTER_MODEL'):
34-
from .generic import ChordCounter
35-
3634
return ChordCounter
3735

3836
try:
@@ -55,8 +53,6 @@ def chordcounter_model():
5553
def groupresult_model():
5654
"""Return the GroupResult model that is active in this project."""
5755
if not hasattr(settings, 'CELERY_RESULTS_GROUPRESULT_MODEL'):
58-
from .generic import GroupResult
59-
6056
return GroupResult
6157

6258
try:

0 commit comments

Comments
 (0)