Add Mastodon bot to Ticketfrei 3 #2
No reviewers
Labels
No labels
backend
bug
duplicate
enhancement
frontend
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: ticketfrei/ticketfrei3#2
Loading…
Reference in a new issue
No description provided.
Delete branch "mastodon"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Anything missing?
Feedback welcome :)
4d105676c2
tof66375cd77
f66375cd77
to48b177d51e
bcc3f442ed
tod72a23781d
@ -0,0 +78,4 @@
await self.publish(Message(text))
await get_event_loop().run_in_executor(
None, self.account.notifications_dismiss, status["id"]
)
I like dismissing old notifications on the platform instead of keeping track of
last_seen
ourselves, but we didn't do this in ticketfrei2, so we need to dismiss all the past notifications during the migration.@ -0,0 +79,4 @@
await get_event_loop().run_in_executor(
None, self.account.notifications_dismiss, status["id"]
)
await sleep(self.polling_interval_sec)
This is for rate limiting, I assume? We could maybe make this a bit more dynamic.
https://mastodonpy.readthedocs.io/en/stable/01_general.html#rate-limiting mentions that the default is 300 requests in 5 minutes, that would allow polling once per second instead of once per minute. But we don't know in advance how often we're gonna post, and the rate limit can be non-default.
Using the
pace
rate limit option is probably not possible with async? What we could use instead is thethrow
option to throw aMastodonRateLimitError
if we run against the rate limit, request https://mastodonpy.readthedocs.io/en/stable/01_general.html#rate-limiting, and decide upon that for how long we do anawait sleep()
.Or even better, use https://mastodonpy.readthedocs.io/en/stable/01_general.html#mastodon.Mastodon.ratelimit_remaining and https://mastodonpy.readthedocs.io/en/stable/01_general.html#mastodon.Mastodon.ratelimit_reset to guess how long we should sleep between requests, and if we hit a
MastodonRateLimitError
, we wait until https://mastodonpy.readthedocs.io/en/stable/01_general.html#mastodon.Mastodon.ratelimit_reset.a6c0b9c962
toec0abb5e24
WIP: add Mastodon bot to Ticketfrei 3to Add Mastodon bot to Ticketfrei 3@ -16,9 +17,10 @@ git_push.sh
index.ts
model/bodyAccessToken.ts
model/bodyAdmin.ts
model/bodyAdminLoginAdminLoginPost.ts
Why was this removed?