atproto_hub: send requestCrawl to bsky.network every 5m

recommended by Jaz, the relay is usually good about reconnecting, but not perfect, and doesn't retry forever. https://discord.com/channels/1097580399187738645/1097580399187738648/1261023248079126529
pull/1187/head
Ryan Barrett 2024-07-12 07:50:00 -07:00
rodzic 7b0151b0cf
commit 2386e92416
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -73,14 +73,16 @@ if LOCAL_SERVER or not DEBUG:
Thread(target=atproto_firehose.handler, name='atproto_firehose.handler').start()
# send requestCrawl to relay
# delay because we're not up and serving XRPCs at this point yet. not sure why not.
# send requestCrawl to relay every 5m.
# delay 15s at startup because we're not up and serving XRPCs at this point yet.
# not sure why not.
if 'GAE_INSTANCE' in os.environ: # prod
def request_crawl():
bgs = lexrpc.client.Client(f'https://{os.environ["BGS_HOST"]}',
headers={'User-Agent': USER_AGENT})
resp = bgs.com.atproto.sync.requestCrawl({'hostname': os.environ['PDS_HOST']})
logger.info(resp)
Timer(5 * 60, request_crawl).start()
Timer(15, request_crawl).start()
logger.info('Will send relay requestCrawl in 15s')