python - Stop retrying periodic celery task on error -


imagine task in celery schedule, runs each minute , sends email on errors. if there error, it's more persistent, database unavailability, mail box get's spammed similar emails.

what's possible workarounds?

you use flag program knows whether has sent alarm email, gets set false once database comes online

the code example of concept.. it's unrelated celery, i'm sure can work fit needs

database_flag = false  database = get_database()  while true:     if not database.is_faulted():         database_flag = false     elif database.is_faulted() , not database_flag:         send_email()         database_flag = true      time.sleep(60) 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -