mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
set instance.start_trying_again if it has not been already
This commit is contained in:
parent
0771bc8386
commit
c37a01fde4
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue