mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-01 17:02:25 -05:00
[chore] Move DoOnce func wrapper to util (#2613)
This commit is contained in:
parent
6738fd5bb0
commit
7a7746701d
5 changed files with 36 additions and 16 deletions
|
|
@ -23,17 +23,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
)
|
||||
|
||||
// doOnce wraps a function to only perform it once.
|
||||
func doOnce(fn func()) func() {
|
||||
var once int32
|
||||
return func() {
|
||||
if once == 0 {
|
||||
fn()
|
||||
once = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pollChanged returns whether a poll has changed in way that
|
||||
// indicates that this should be an entirely new poll. i.e. if
|
||||
// the available options have changed, or the expiry has increased.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue