Reactors vs. db.rollback()
Nagy Gabor <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.user |
|---|---|
| Message-ID | <20210806020306.01ce3eee@Dell> |
Dear Roundup users!
I am using a custom reactor to notify users by email about a successful
database transaction. (In more detail, I have a webpage where anonymous
users can upload their data to my roundup db. For security reasons,
this page is not served by roundup-server, but a simple CGI script
processes the uploaded data and files, and writes them to the db. Slow
net connection can cause problems during multipart form uploading, so I
realized that the safest thing to do is to send an "upload successfully
completed" confirmation email from Roundup's db reactor when a new
"incoming" issue is successfully created.)
However, I noticed that the reactor is called from
db.incoming.create(), so the reactor runs before db.commit() is even
invoked. This seems reasonable in most cases, but it is not in this
case: My CGI script cleans up everything by db.rollback() if something
goes wrong; in this case the information email is sent, but the db is
not changed at all. (In fact, this has almost zero probability, because
db.incoming.create(...) is the last command before db.commit()). But
this brought me to the question: Is it possible to set-up a
("hook"-like) reactor which is fired only when/after db.commit() is
called? In my case, sending a "liar" email is a bigger problem than not
sending the email.
Regards,
Gábor
_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users