From 7a7746701df54decb4763ff2813bb9897a178ccf Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 9 Feb 2024 12:38:51 +0100 Subject: [chore] Move `DoOnce` func wrapper to util (#2613) --- internal/federation/dereferencing/account.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'internal/federation/dereferencing/account.go') diff --git a/internal/federation/dereferencing/account.go b/internal/federation/dereferencing/account.go index d51d3078e..86ea9b7fd 100644 --- a/internal/federation/dereferencing/account.go +++ b/internal/federation/dereferencing/account.go @@ -37,6 +37,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/media" "github.com/superseriousbusiness/gotosocial/internal/transport" + "github.com/superseriousbusiness/gotosocial/internal/util" ) // accountUpToDate returns whether the given account model is both updateable (i.e. @@ -384,7 +385,7 @@ func (d *Dereferencer) enrichAccountSafely( // to safely defer in case of panic, while still // performing more granular unlocks when needed. unlock := d.state.FedLocks.Lock(uriStr) - unlock = doOnce(unlock) + unlock = util.DoOnce(unlock) defer unlock() // Perform status enrichment with passed vars. @@ -735,7 +736,7 @@ func (d *Dereferencer) fetchRemoteAccountAvatar(ctx context.Context, tsport tran // Acquire lock for derefs map. unlock := d.state.FedLocks.Lock(latestAcc.AvatarRemoteURL) - unlock = doOnce(unlock) + unlock = util.DoOnce(unlock) defer unlock() // Look for an existing dereference in progress. @@ -821,7 +822,7 @@ func (d *Dereferencer) fetchRemoteAccountHeader(ctx context.Context, tsport tran // Acquire lock for derefs map. unlock := d.state.FedLocks.Lock(latestAcc.HeaderRemoteURL) - unlock = doOnce(unlock) + unlock = util.DoOnce(unlock) defer unlock() // Look for an existing dereference in progress. -- cgit v1.2.3