don't try to set peers that don't exist
This commit is contained in:
parent
d55d437369
commit
414578a760
|
@ -26,7 +26,7 @@ from scraper.management.commands._util import require_lock, InvalidResponseError
|
||||||
|
|
||||||
# TODO: use the /api/v1/server/followers and /api/v1/server/following endpoints in peertube instances
|
# TODO: use the /api/v1/server/followers and /api/v1/server/following endpoints in peertube instances
|
||||||
|
|
||||||
SEED = 'mastodon.social'
|
SEED = 'geekly.social'
|
||||||
TIMEOUT = 20
|
TIMEOUT = 20
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,6 +90,8 @@ class Command(BaseCommand):
|
||||||
stats.save()
|
stats.save()
|
||||||
# Save peers
|
# Save peers
|
||||||
# TODO: make this shared amongst threads so the database only needs to be queried once
|
# TODO: make this shared amongst threads so the database only needs to be queried once
|
||||||
|
if not data['peers']:
|
||||||
|
return
|
||||||
existing_instance_ids = Instance.objects.values_list('name', flat=True)
|
existing_instance_ids = Instance.objects.values_list('name', flat=True)
|
||||||
existing_peers = Instance.objects.filter(name__in=existing_instance_ids)
|
existing_peers = Instance.objects.filter(name__in=existing_instance_ids)
|
||||||
new_peer_ids = [peer for peer in data['peers'] if peer not in existing_instance_ids]
|
new_peer_ids = [peer for peer in data['peers'] if peer not in existing_instance_ids]
|
||||||
|
|
Loading…
Reference in a new issue