From 28f350dd4649c70fcd05db2813fb1e2aa01dad9e Mon Sep 17 00:00:00 2001 From: Christopher Usher Date: Mon, 24 Jun 2019 11:39:18 +0200 Subject: [PATCH] Also reset database connection on error in the backfiller --- backfiller/backfiller/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backfiller/backfiller/main.py b/backfiller/backfiller/main.py index 0e3d20b..c28b024 100644 --- a/backfiller/backfiller/main.py +++ b/backfiller/backfiller/main.py @@ -197,6 +197,9 @@ class BackfillerManager(object): try: new_nodes = set(self.get_nodes()) except Exception: + # To ensure a fresh slate and clear any DB-related errors, get a new conn on error. + # This is heavy-handed but simple and effective. + self.connection = database.DBManager(dsn=self.node_database).get_conn() if failures < MAX_BACKOFF: failures += 1 delay = common.jitter(TIMEOUT * 2**failures)