diff --git a/app/community/util.py b/app/community/util.py index 10866585..b3b8841d 100644 --- a/app/community/util.py +++ b/app/community/util.py @@ -1,5 +1,4 @@ from datetime import datetime, timedelta -from threading import Thread from time import sleep from random import randint from typing import List @@ -717,7 +716,7 @@ def send_to_remote_instance_task(instance_id: int, community_id: int, payload): community = Community.query.get(community_id) if community: instance = Instance.query.get(instance_id) - if instance.inbox and instance.online(): + 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'): instance.last_successful_send = utcnow() instance.failures = 0 diff --git a/app/utils.py b/app/utils.py index 838c1d5d..35026a37 100644 --- a/app/utils.py +++ b/app/utils.py @@ -571,7 +571,7 @@ def user_ip_banned() -> bool: return current_ip_address in banned_ip_addresses() -@cache.memoize(timeout=30) +@cache.memoize(timeout=60) def instance_banned(domain: str) -> bool: # see also activitypub.util.instance_blocked() if domain is None or domain == '': return False