ATProto: tweak polling: every 5 min, 10 items each call

pull/968/head
Ryan Barrett 2024-04-23 16:58:30 -07:00
rodzic 0238b46e36
commit 4efb0d3e35
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
3 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -594,7 +594,7 @@ def poll_notifications():
client.session['accessJwt'] = service_jwt(os.environ['APPVIEW_HOST'],
repo_did=did,
privkey=repo.signing_key)
resp = client.app.bsky.notification.listNotifications()
resp = client.app.bsky.notification.listNotifications(limit=10)
for notif in resp['notifications']:
actor_did = notif['author']['did']
logger.debug(f'Got {notif["reason"]} from {notif["author"]["handle"]} {notif["uri"]} {notif["cid"]} : {json_dumps(notif, indent=2)}')
@ -653,7 +653,7 @@ def poll_posts():
client.session['accessJwt'] = service_jwt(os.environ['APPVIEW_HOST'],
repo_did=did,
privkey=repo.signing_key)
resp = client.app.bsky.feed.getTimeline()
resp = client.app.bsky.feed.getTimeline(limit=10)
for item in resp['feed']:
# TODO: handle reposts once we have a URI for them
# https://github.com/bluesky-social/atproto/issues/1811

Wyświetl plik

@ -4,10 +4,10 @@
cron:
- description: ATProto poll posts
url: /queue/atproto-poll-posts
schedule: every 15 minutes
schedule: every 5 minutes
target: hub
- description: ATProto poll notifications
url: /queue/atproto-poll-notifs
schedule: every 15 minutes
schedule: every 5 minutes
target: hub

Wyświetl plik

@ -1192,7 +1192,7 @@ class ATProtoTest(TestCase):
self.assertEqual(200, resp.status_code)
expected_list_notifs = call(
'https://api.bsky-sandbox.dev/xrpc/app.bsky.notification.listNotifications',
'https://api.bsky-sandbox.dev/xrpc/app.bsky.notification.listNotifications?limit=10',
json=None, data=None,
headers={
'Content-Type': 'application/json',
@ -1290,7 +1290,7 @@ class ATProtoTest(TestCase):
self.assertEqual(200, resp.status_code)
get_timeline = call(
'https://api.bsky-sandbox.dev/xrpc/app.bsky.feed.getTimeline',
'https://api.bsky-sandbox.dev/xrpc/app.bsky.feed.getTimeline?limit=10',
json=None, data=None,
headers={
'Content-Type': 'application/json',