set instance.start_trying_again if it has not been already

This commit is contained in:
rimu 2024-09-30 15:58:02 +13:00
parent 0771bc8386
commit c37a01fde4

View file

@ -765,9 +765,13 @@ def inbox_domain(inbox: str) -> str:
def awaken_dormant_instance(instance): def awaken_dormant_instance(instance):
if instance and not instance.gone_forever: if instance and not instance.gone_forever:
if instance.dormant: if instance.dormant:
if instance.start_trying_again < utcnow(): if instance.start_trying_again is None:
instance.dormant = False instance.start_trying_again = utcnow() + timedelta(seconds=instance.failures ** 4)
db.session.commit() db.session.commit()
else:
if instance.start_trying_again < utcnow():
instance.dormant = False
db.session.commit()
# give up after ~5 days of trying # give up after ~5 days of trying
if instance.start_trying_again and utcnow() + timedelta(days=5) < instance.start_trying_again: if instance.start_trying_again and utcnow() + timedelta(days=5) < instance.start_trying_again:
instance.gone_forever = True instance.gone_forever = True