-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update Completed Work status and Payment in form Processor #416
Conversation
status__in=[CompletedWorkStatus.rejected, CompletedWorkStatus.over_limit] | ||
).select_related("payment_unit") | ||
update_status(completed_works, access, True) | ||
with cache.lock(f"update_payment_accrued_lock_{access.id}"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this handle failure? when does the lock timeout to avoid deadlocks, and if multiple forms come in quick succession will this block the for receiver view for an extended period?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cache lock has blocking behavior, so if requests come in quick succession they will be blocked until the code inside the lock has completed executing. The timeouts on these locks are infinite by default i.e. they wait for the execution of code to complete before releasing the lock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a timeout to avoid deadlock. Longer than the work will actually take, but that way if there is an unhandled exception or unexpected failure, it wont block all other work forever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. d33b0af
Ticket
This PR adds code to update the completed work status and payment accrued (through the
update_payment_accrued
function) for a user when a form is submitted.