kopia lustrzana https://github.com/snarfed/bridgy-fed
ATProto: tweak polling: every 5 min, 10 items each call
rodzic
0238b46e36
commit
4efb0d3e35
|
@ -594,7 +594,7 @@ def poll_notifications():
|
||||||
client.session['accessJwt'] = service_jwt(os.environ['APPVIEW_HOST'],
|
client.session['accessJwt'] = service_jwt(os.environ['APPVIEW_HOST'],
|
||||||
repo_did=did,
|
repo_did=did,
|
||||||
privkey=repo.signing_key)
|
privkey=repo.signing_key)
|
||||||
resp = client.app.bsky.notification.listNotifications()
|
resp = client.app.bsky.notification.listNotifications(limit=10)
|
||||||
for notif in resp['notifications']:
|
for notif in resp['notifications']:
|
||||||
actor_did = notif['author']['did']
|
actor_did = notif['author']['did']
|
||||||
logger.debug(f'Got {notif["reason"]} from {notif["author"]["handle"]} {notif["uri"]} {notif["cid"]} : {json_dumps(notif, indent=2)}')
|
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'],
|
client.session['accessJwt'] = service_jwt(os.environ['APPVIEW_HOST'],
|
||||||
repo_did=did,
|
repo_did=did,
|
||||||
privkey=repo.signing_key)
|
privkey=repo.signing_key)
|
||||||
resp = client.app.bsky.feed.getTimeline()
|
resp = client.app.bsky.feed.getTimeline(limit=10)
|
||||||
for item in resp['feed']:
|
for item in resp['feed']:
|
||||||
# TODO: handle reposts once we have a URI for them
|
# TODO: handle reposts once we have a URI for them
|
||||||
# https://github.com/bluesky-social/atproto/issues/1811
|
# https://github.com/bluesky-social/atproto/issues/1811
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
cron:
|
cron:
|
||||||
- description: ATProto poll posts
|
- description: ATProto poll posts
|
||||||
url: /queue/atproto-poll-posts
|
url: /queue/atproto-poll-posts
|
||||||
schedule: every 15 minutes
|
schedule: every 5 minutes
|
||||||
target: hub
|
target: hub
|
||||||
|
|
||||||
- description: ATProto poll notifications
|
- description: ATProto poll notifications
|
||||||
url: /queue/atproto-poll-notifs
|
url: /queue/atproto-poll-notifs
|
||||||
schedule: every 15 minutes
|
schedule: every 5 minutes
|
||||||
target: hub
|
target: hub
|
||||||
|
|
|
@ -1192,7 +1192,7 @@ class ATProtoTest(TestCase):
|
||||||
self.assertEqual(200, resp.status_code)
|
self.assertEqual(200, resp.status_code)
|
||||||
|
|
||||||
expected_list_notifs = call(
|
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,
|
json=None, data=None,
|
||||||
headers={
|
headers={
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
@ -1290,7 +1290,7 @@ class ATProtoTest(TestCase):
|
||||||
self.assertEqual(200, resp.status_code)
|
self.assertEqual(200, resp.status_code)
|
||||||
|
|
||||||
get_timeline = call(
|
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,
|
json=None, data=None,
|
||||||
headers={
|
headers={
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|
Ładowanie…
Reference in New Issue