Background
I have an PayPal IPN handler in PHP`(5.2) that processes transactions and store date in a MySQL database. The site has low activity.
Occasionally the MySQL query fails. (Very rarely) I log everything and if a PayPal message failed to be processed I can just look in my log file and resend the PayPal message.
Ideas / Concerns
But I was wondering if I could make the process a bit more robust and instead have the handler re-try the mysql query before giving up.
I probably want to wait a little bit - not hammering multiple query attempts immediately after each other.
I was hoping to find some patterns for this - searching for stuff like "php mysql query retry" without having much success in that.
Questions
Are there good practice guides for this?
Existing libraries?
Is a simple loop and
sleep
between each query attempt ok, or can that have undesired side-effects? Too native?