RandomWireTechnologies / ctrl-o-node

This is the python code that runs on the Ctrl-O Nodes
Artistic License 2.0
6 stars 3 forks source link

Door doesn't work when cannot contact remote DB #8

Open pataelmo opened 9 years ago

pataelmo commented 9 years ago

The code doesn't properly handle the remote database connection being slow nor not available. This may need to be dealt with threads or just better handling of code and setting shorter timeouts (if available)

pataelmo commented 9 years ago

The root of this issue is that in the main loop we're periodically pinging the database to keep the connection alive. Which is an issue because when the server becomes unavailable the MySQLdb.ping function which is used to check the connection blocks until it can get an answer back, sometimes indefinitely. This stops the main loop from checking cards and/or doing anything else useful. Need to find another solution or hide this code in a thread to make it not block the main loop.