I have a large record import job running on our web application. The import is run by a PORO which calculates how many objects it needs to import and divides the number by an index of the current object it is presently on, leaving me with a clean way to calculate the percentage complete. After it does this calculation I am saving this percentage to the database in order to poll it and let the user know how far along this import has come.
It doesn't appear that sidekiq allows for these database writes to touch the database until the entire job is over, leaving me with this quesiton:
Is every sidekiq job wrapped entirely in a transaction?
(I'm not lazy I just don't have a lot of time to go through the code and discover this myself.)
No, Sidekiq does not inherently wrap it's jobs in a transaction. Ensure you don't have your loop, or the method calling your loop, wrapped in a transaction.