From c37a01fde46e56086522c34f8b2aec94372a9a2e Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:58:02 +1300 Subject: [PATCH] set instance.start_trying_again if it has not been already --- app/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/utils.py b/app/utils.py index f36057e0..f7d003ab 100644 --- a/app/utils.py +++ b/app/utils.py @@ -765,9 +765,13 @@ def inbox_domain(inbox: str) -> str: def awaken_dormant_instance(instance): if instance and not instance.gone_forever: if instance.dormant: - if instance.start_trying_again < utcnow(): - instance.dormant = False + if instance.start_trying_again is None: + instance.start_trying_again = utcnow() + timedelta(seconds=instance.failures ** 4) db.session.commit() + else: + if instance.start_trying_again < utcnow(): + instance.dormant = False + db.session.commit() # give up after ~5 days of trying if instance.start_trying_again and utcnow() + timedelta(days=5) < instance.start_trying_again: instance.gone_forever = True