Closed rebeccacremona closed 7 months ago
Attention: 1 lines
in your changes are missing coverage. Please review.
Comparison is base (
64981a3
) 76.48% compared to head (6940e62
) 76.55%. Report is 1 commits behind head on develop.
Files | Patch % | Lines |
---|---|---|
web/main/models.py | 87.50% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This pull request was deployed and Sentry observed the following issues:
/casebooks/{casebook_param})/publish/
View IssueDid you find this useful? React with a 👍 or 👎
If you attempt to "publish" the same draft multiple times and make your requests quickly enough, multiple attempts may pass this test and proceed through the merging code.
That is never desirable.
And I have not yet definitively proved, but am quite convinced that this occasionally completely corrupts the casebook involved.
This PR uses
select_for_update
to ensure that only one publication attempt is ever in progress at once.The user experience could still use some polishing: right now, on prod, if something goes wrong with the "publish" modal (for instance, you open two tabs with a draft, and click publish in one, wait a few seconds, and then click publish in the other), the modal just stays open. Your request gets a 400... but unless the dev tools are open, you don't see any notification.
I tried to fix that in this PR too, so that I could add an error message for THAT situation AND for the situation this PR fixes. But I couldn't figure it out...
But, I think this is worth it even without that: a weirdly not-closing modal is better than a potentially corrupted book!