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

Retry celery patron sync on StaleDataError (PP-2005) #2207

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

jonathangreen
Copy link
Member

Description

Retry when we get a StaleDataError while running a patron sync.

Motivation and Context

Looking at the cloudwatch alarms we are getting for failed Celery tasks, it looks like almost all of them are:

sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'loans' expected to update 1 row(s); 0 were matched.

These are probably mostly unavoidable, due to something happening (like a checkout or checkin) while the sync task is running. Just retrying should solve the issue.

How Has This Been Tested?

  • Added unit tests

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@jonathangreen jonathangreen added the bug Something isn't working label Dec 9, 2024
@jonathangreen jonathangreen requested a review from a team December 9, 2024 15:50
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.09%. Comparing base (0ff6c7d) to head (435e512).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2207   +/-   ##
=======================================
  Coverage   91.09%   91.09%           
=======================================
  Files         363      363           
  Lines       41224    41227    +3     
  Branches     8834     8835    +1     
=======================================
+ Hits        37553    37556    +3     
  Misses       2406     2406           
  Partials     1265     1265           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@dbernstein dbernstein left a comment

Choose a reason for hiding this comment

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

🚀

@jonathangreen jonathangreen merged commit ec00a8e into main Dec 9, 2024
21 checks passed
@jonathangreen jonathangreen deleted the bugfix/celery-sync-task branch December 9, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants