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 :)
4d105676c2tof66375cd77f66375cd77to48b177d51ebcc3f442edtod72a23781d@ -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_seenourselves, 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
pacerate limit option is probably not possible with async? What we could use instead is thethrowoption to throw aMastodonRateLimitErrorif 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.a6c0b9c962toec0abb5e24WIP: add Mastodon bot to Ticketfrei 3to Add Mastodon bot to Ticketfrei 3@ -16,9 +17,10 @@ git_push.shindex.tsmodel/bodyAccessToken.tsmodel/bodyAdmin.tsmodel/bodyAdminLoginAdminLoginPost.tsWhy was this removed?