yuletide / nitterbot

A mastodon bot to replace twitter links with Nitter links to view without ads or tracking
https://botsin.space/@nitterbot
9 stars 3 forks source link

Convert to async #3

Closed yuletide closed 1 year ago

yuletide commented 1 year ago

Railway only allows 500 hours / month on free tier and current streaming implementation blocks

Would converting to async reduce dyno usage?

If run_async is True, the listener will listen on another thread and these methods will return a handle corresponding to the open connection. If, in addition, reconnect_async is True, the thread will attempt to reconnect to the streaming API if any errors are encountered, waiting reconnect_async_wait_sec seconds between reconnection attempts. Note that no effort is made to “catch up” - events created while the connection is broken will not be received. If you need to make sure to get absolutely all notifications / deletes / toots, you will have to do that manually, e.g. using the on_abort handler to fill in events since the last received one and then reconnecting. Both run_async and reconnect_async default to false, and you’ll have to set each to true separately to get the behaviour described above.

https://mastodonpy.readthedocs.io/en/stable/10_streaming.html

yuletide commented 1 year ago

WIth Fly.IO this is no longer needed. Streaming seems like a fine way to run for now so closing