Fix remote instance ping

This commit is contained in:
petitminion 2022-10-27 15:46:01 +00:00 committed by Georg Krause
parent 7d0ec12253
commit 78c3764cc6
2 changed files with 5 additions and 2 deletions

View File

@ -862,8 +862,8 @@ CELERY_BEAT_SCHEDULE = {
"schedule": crontab(day_of_week="1", minute="0", hour="2"),
"options": {"expires": 60 * 60 * 24},
},
"federation.check_remote_instance_availability": {
"task": "federation.check_remote_instance_availability",
"federation.check_all_remote_instance_availability": {
"task": "federation.check_all_remote_instance_availability",
"schedule": crontab(
**env.dict(
"SCHEDULE_FEDERATION_CHECK_INTANCES_AVAILABILITY",

View File

@ -646,14 +646,17 @@ def check_single_remote_instance_availability(domain):
)
domain.reachable = False
domain.save()
return domain.reachable
if "version" in nodeinfo.keys():
domain.reachable = True
domain.last_successful_contact = datetime.datetime.now()
domain.save()
return domain.reachable
else:
logger.info(
f"Domain {domain.name} is not reacheable at the moment. Setting domain as unreacheable."
)
domain.reachable = False
domain.save()
return domain.reachable