Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions django_celery_results/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ def warn_if_repeatable_read(self):
if isolation == 'REPEATABLE-READ':
warnings.warn(TxIsolationWarning(W_ISOLATION_REP.strip()))

def database_for_write(self):
return router.db_for_write(self.model)

def connection_for_write(self):
return connections[router.db_for_write(self.model)]
return connections[self.database_for_write()]

def connection_for_read(self):
return connections[self.db]
Expand All @@ -86,7 +89,7 @@ def get_all_expired(self, expires):

def delete_expired(self, expires):
"""Delete all expired results."""
with transaction.atomic(using=self.db):
with transaction.atomic(using=self.database_for_write()):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also resolve the merge conflict please?

raw_delete(queryset=self.get_all_expired(expires))


Expand Down