I'm using this recipe: http://code.activestate.com/recipes/278731/ on an Ubuntu server.
I make a daemon instance like this:
class MyDaemon(Daemon):
def run(self):
while True:
try:
do_my_data_processing()
except MySQLdb.OperationalError:
# Sleep an extra 30 seconds if database is away.
time.sleep(30)
time.sleep(30)
The problem is that even while sleeping the daemon takes up almost all available CPU power.
What am I doing wrong?