alphagov / asset-manager

Manages uploaded assets (images, PDFs etc.) for applications on GOV.UK

Home Page:https://docs.publishing.service.gov.uk/apps/asset-manager.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ensure all AssetManager-related Sidekiq jobs in Whitehall are idempotent

floehopper opened this issue · comments

As recommended in https://github.com/mperham/sidekiq/wiki/Best-Practices#2-make-your-job-idempotent-and-transactional. In particular the last sentence says:

Just remember that Sidekiq will execute your job at least once, not exactly once.

This last sentence is a bit ambiguous. In isolation it makes it sound as if the same job may run multiple times even if it's not retried. This might explain some behaviour that @chrislo & @chrisroos observed recently. However, if you read that sentence in the context of the rest of the paragraph, it sounds as if a job might only ever run once if no exceptions are raised.

In any case, we should ensure that all the jobs are idempotent to avoid this ever being a problem.