Queue processing for large receipt runs
Created by: jake-mw
The root issue in #38 (closed) -- timeouts when running large batches of receipts on certain servers -- means that large batches of tax receipts can be lost if the server times out half way through processing. Once the server times out, the receipts that were already issued can't be issued again. But the printout hasn't yet been downloaded. So there's a lot of cleanup that needs to happen in order to rescue a half-finished process: need to clean up the tax archive, remove entries from the database log (through the mysql backend) and then try to issue again using a smaller batch size.
While some folks can change their server settings to allow longer execution time, this isn't available to everyone. Nor are most users able (nor should they) manually clean up the underlying database tables. And if it's a mix of hardcopy & email receipts that are being issued when the timeout occurred, it becomes a real mess.
We should probably queue up the expensive operations when issuing large batches of receipts (e.g. the individual emails sent to the email archive), and process the queue in a separate process.