I'm running a small Web app on a shared hosting plan.
I have a "worker function" which contains an infinite loop; the loop checks a task queue in the DB for new things to do. This necessitated using @transaction.commit_manually
in order to defeat Django's caching and get up-to-date info on every iteration.
I recently implemented DB logging, and therefore needed to introduce using savepoints to my worker function - this way, if anything goes awry, I can rollback to a good savepoint, log to the database, and carry on until I reach the final transaction.commit()
Now, unlike my development server, the production server gives me the error:
DatabaseError: (1305, 'SAVEPOINT s140364713719520_x1 does not exist')
pointing to a transaction.savepoint_rollback()
call in an except
block (see source below). The dev server has no such problems; and the production server happily yields savepoint IDs if I type transaction.savepoint()
in an interactive shell.
This is the outline of my code, if it'd be of any help; I've tried to keep it concise.
If there's any benevolent Python gurus out there, please help me. I'm getting really frustrated over this, although I think I'm doing a fairly good job at handling it in a calm manner.