❔ how do i make blob and entity deletion atomic?
In this code, what if blob removal is successful but listingphotos.remove somehow fails?
1. Is it something to worry about?
2. Should I do retries?
3. Compensating transaction of some kind? if removal of the entity fails > restore the deleted blob?
11 Replies
Remove the entry from the database first, and remove the file from the blob storage only if that succeeded
Haha, that is almost hilariously simple and would solve my problem.
lol
@AngiusShould i retry the blob deletion then? maybe i dont want wasted space
elsewhere maybe, match it against db records
maybe a background task
I'd retry, like, once
If that fails, just log it and handle it somehow else
gotcha, and by handle it somehow else maybe a regularly scheduled background task?
That could work, yeah
Save all the orphaned files to some JSON file or a database table or something
And run cleanup once a week or so
You could even skip the retries then, rbh
yeah, sounds like a good approach. does the code look ok other than that?
LGTM at a glance
thanks, appreciate the help. actually suspected you would reply when i posted haha, you've replied on all my posts 😄
dfont know how u do it but man u put in the time and it's great
I simply browse #help regularly lol
yeah, uir doin the lords work man 😛 cheers
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.