Refactor Poll Refreshing
The current behavior for poll refreshing is to attempt to fetch the poll results synchronously when rendering the poll activity if it has not been refetched in the last 60 seconds. This can lead to poor performance when rendering timelines and is not polite to remote servers.
This MR adds new behavior:
- Polls are refreshed by an Oban job with a uniqueness enforcement of
60 secondslike previous behavior, but asynchronously edit: it is now increased to 120 seconds - Successful object refetches for a poll will stream the update over websockets (PleromaFE, mostly)
- If the poll is closed and the
updated_at
timestamp is more recent than the pollclosed
timestamp we consider the existing data to be the final results and will not fetch updates anymore. - Before streaming out notifications to users when a poll has closed we schedule a refresh job to try to ensure the latest poll data is available by the time they view the notification
Edited by feld