Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hard dependency on psycopg2 #292

Merged
merged 1 commit into from Mar 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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