[bugfix] use a much shorter refresh limit for statuses with polls (#2453)

* specifically use a much shorter refresh limit for statuses with polls

* allow specifying whether status must be upToDate in calls to Get(Visible)?TargetStatusBy_(), limit force refresh to 5 minute cooldown

* remove the PollID check from statusUpToDate()

* remove unnecessary force flag checks

* remove unused field

* check refresh status error

* use argument name 'refresh' instead of 'upToDate' to better fit with the codebase

* add statuses_poll_id_idx

* remove the definitely-not copy-pasted comment i accidentally typed out in full

* only synchronously refresh if the refresh flag is provided, otherwise do async

* fix wrong force value being provided for async

---------

Co-authored-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
kim 2023-12-15 14:24:39 +00:00 committed by GitHub
commit f4fcffc8b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 207 additions and 98 deletions

View file

@ -27,9 +27,6 @@ type Poll interface {
// GetPollByID fetches the Poll with given ID from the database.
GetPollByID(ctx context.Context, id string) (*gtsmodel.Poll, error)
// GetPollByStatusID fetches the Poll with given status ID column value from the database.
GetPollByStatusID(ctx context.Context, statusID string) (*gtsmodel.Poll, error)
// GetOpenPolls fetches all local Polls in the database with an unset `closed_at` column.
GetOpenPolls(ctx context.Context) ([]*gtsmodel.Poll, error)