Skip to content

Commit

Permalink
Remove hard dependency on psycopg2
Browse files Browse the repository at this point in the history
One would reasonably expect django-celery-results to work with other databases without installing psycopg2.

The hard dependency was added in commit 28fb1c6, probably unintentional without fully understanding this aspect.
  • Loading branch information
intgr authored and auvipy committed Mar 4, 2022
1 parent 9735e28 commit 5f507c8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions django_celery_results/backends/database.py
Expand Up @@ -10,13 +10,18 @@
from django.db import connection, transaction
from django.db.utils import InterfaceError
from kombu.exceptions import DecodeError
from psycopg2 import InterfaceError as Psycopg2InterfaceError

from ..models import ChordCounter
from ..models import GroupResult as GroupResultModel
from ..models import TaskResult

EXCEPTIONS_TO_CATCH = (InterfaceError, Psycopg2InterfaceError)
EXCEPTIONS_TO_CATCH = (InterfaceError,)

try:
from psycopg2 import InterfaceError as Psycopg2InterfaceError
EXCEPTIONS_TO_CATCH += (Psycopg2InterfaceError,)
except ImportError:
pass

logger = get_logger(__name__)

Expand Down

0 comments on commit 5f507c8

Please sign in to comment.