fix: Local instance is always reachable to itself

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2321>
pipelines/27771
Georg Krause 2023-01-19 08:25:24 +01:00 zatwierdzone przez Marge
rodzic af6fd0911a
commit 934e179d59
2 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -633,7 +633,12 @@ def fetch_collection(url, max_pages, channel, is_page=False):
def check_all_remote_instance_availability():
domains = models.Domain.objects.all().prefetch_related()
for domain in domains:
check_single_remote_instance_availability(domain)
if domain == settings.FUNKWHALE_HOSTNAME:
# No need to check the instance itself: Its always reachable
domain.reachable = True
domain.last_successful_contact = timezone.now()
else:
check_single_remote_instance_availability(domain)
@celery.app.task(name="federation.check_single_remote_instance_availability")

Wyświetl plik

@ -1173,7 +1173,9 @@ class LibraryQuerySet(models.QuerySet):
)
.values_list("target__channel__library", flat=True)
)
domains_reachable = federation_models.Domain.objects.filter(reachable=True)
domains_reachable = federation_models.Domain.objects.filter(
reachable=True
) | federation_models.Domain.objects.filter(name=settings.FUNKWHALE_HOSTNAME)
return self.filter(
me_query