Skip to content

don't catch database exceptions and ignore them #431

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
Closed
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
20 changes: 8 additions & 12 deletions djcelery/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,16 @@ def all_as_schedule(self):
return s

def schedule_changed(self):
# If MySQL is running with transaction isolation level
# REPEATABLE-READ (default), then we won't see changes done by
# other transactions until the current transaction is
# committed (Issue #41).
try:
# If MySQL is running with transaction isolation level
# REPEATABLE-READ (default), then we won't see changes done by
# other transactions until the current transaction is
# committed (Issue #41).
try:
transaction.commit()
except transaction.TransactionManagementError:
pass # not in transaction management.
transaction.commit()
except transaction.TransactionManagementError:
pass # not in transaction management.

last, ts = self._last_timestamp, self.Changes.last_change()
except DATABASE_ERRORS as exc:
error('Database gave error: %r', exc, exc_info=1)
return False
last, ts = self._last_timestamp, self.Changes.last_change()
try:

Choose a reason for hiding this comment

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

Why does this have to be in a try/finally block?

if ts and ts > (last if last else ts):
return True
Expand Down