[chore] Move DoOnce func wrapper to util (#2613)

This commit is contained in:
tobi 2024-02-09 12:38:51 +01:00 committed by GitHub
commit 7a7746701d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 36 additions and 16 deletions

View file

@ -28,6 +28,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/id"
"github.com/superseriousbusiness/gotosocial/internal/log"
"github.com/superseriousbusiness/gotosocial/internal/media"
"github.com/superseriousbusiness/gotosocial/internal/util"
)
func (d *Dereferencer) GetRemoteEmoji(ctx context.Context, requestingUsername string, remoteURL string, shortcode string, domain string, id string, emojiURI string, ai *media.AdditionalEmojiInfo, refresh bool) (*media.ProcessingEmoji, error) {
@ -44,7 +45,7 @@ func (d *Dereferencer) GetRemoteEmoji(ctx context.Context, requestingUsername st
// Acquire lock for derefs map.
unlock := d.state.FedLocks.Lock(remoteURL)
unlock = doOnce(unlock)
unlock = util.DoOnce(unlock)
defer unlock()
// first check if we're already processing this emoji