if the remote instance does not respond to an attempt to refresh a user profile it is probably temporarily overwhelmed

we just received an activity from them so it doesn't make sense to flag the instance as dormant, here.
This commit is contained in:
rimu 2024-04-20 17:33:04 +12:00
parent 2c1efdeb68
commit d4141bb044

View file

@ -401,7 +401,10 @@ def refresh_user_profile_task(user_id):
actor_data = get_request(user.ap_profile_id, headers={'Accept': 'application/activity+json'})
except requests.exceptions.ReadTimeout:
time.sleep(randint(3, 10))
actor_data = get_request(user.ap_profile_id, headers={'Accept': 'application/activity+json'})
try:
actor_data = get_request(user.ap_profile_id, headers={'Accept': 'application/activity+json'})
except requests.exceptions.ReadTimeout:
return
if actor_data.status_code == 200:
activity_json = actor_data.json()
actor_data.close()
@ -456,7 +459,10 @@ def refresh_community_profile_task(community_id):
actor_data = get_request(community.ap_profile_id, headers={'Accept': 'application/activity+json'})
except requests.exceptions.ReadTimeout:
time.sleep(randint(3, 10))
actor_data = get_request(community.ap_profile_id, headers={'Accept': 'application/activity+json'})
try:
actor_data = get_request(community.ap_profile_id, headers={'Accept': 'application/activity+json'})
except Exception as e:
return
if actor_data.status_code == 200:
activity_json = actor_data.json()
actor_data.close()