better instance failure detection

This commit is contained in:
rimu 2024-09-21 10:15:25 +12:00
parent 37d3501136
commit 700b1c98de
2 changed files with 3 additions and 3 deletions

View file

@ -989,7 +989,7 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
"type": "Accept",
"id": f"https://{current_app.config['SERVER_NAME']}/activities/accept/" + gibberish(32)
}
if post_request(user.ap_inbox_url, accept, community.private_key, f"{community.public_url()}#main-key"):
if post_request(user.ap_inbox_url, accept, community.private_key, f"{community.public_url()}#main-key") is True:
activity_log.result = 'success'
else:
activity_log.exception_message = 'Error sending Accept'
@ -1485,7 +1485,7 @@ def process_user_follow_request(request_json, activitypublog_id, remote_user_id)
"type": "Accept",
"id": f"https://{current_app.config['SERVER_NAME']}/activities/accept/" + gibberish(32)
}
if post_request(remote_user.ap_inbox_url, accept, local_user.private_key, f"{local_user.public_url()}#main-key"):
if post_request(remote_user.ap_inbox_url, accept, local_user.private_key, f"{local_user.public_url()}#main-key") is True:
activity_log.result = 'success'
else:
activity_log.exception_message = 'Error sending Accept'

View file

@ -723,7 +723,7 @@ def send_to_remote_instance_task(instance_id: int, community_id: int, payload):
if community:
instance = Instance.query.get(instance_id)
if instance.inbox and instance.online() and not instance_banned(instance.domain):
if post_request(instance.inbox, payload, community.private_key, community.ap_profile_id + '#main-key'):
if post_request(instance.inbox, payload, community.private_key, community.ap_profile_id + '#main-key') is True:
instance.last_successful_send = utcnow()
instance.failures = 0
else: