mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-05-31 22:58:32 +00:00
lock while checking + setting move state
This commit is contained in:
parent
1ba04553af
commit
d9f1e0e458
|
@ -107,6 +107,15 @@ func (p *Processor) MoveSelf(
|
|||
targetAcctable ap.Accountable
|
||||
)
|
||||
|
||||
// Next steps involve checking + setting
|
||||
// state that might get messed up if a
|
||||
// client triggers this function twice
|
||||
// in quick succession, so get a lock on
|
||||
// this account's moves.
|
||||
lockKey := originAcct.URI + "/moves"
|
||||
unlock := p.state.ClientLocks.Lock(lockKey)
|
||||
defer unlock()
|
||||
|
||||
// Ensure we have a valid, up-to-date representation of the target account.
|
||||
targetAcct, targetAcctable, err = p.federator.GetAccountByURI(
|
||||
ctx,
|
||||
|
|
|
@ -50,6 +50,12 @@ type State struct {
|
|||
// functions, and by the go-fed/activity library.
|
||||
FedLocks mutexes.MutexMap
|
||||
|
||||
// ClientLocks provides access to this state's
|
||||
// mutex map of per URI client locks.
|
||||
//
|
||||
// Used during account migration actions.
|
||||
ClientLocks mutexes.MutexMap
|
||||
|
||||
// Storage provides access to the storage driver.
|
||||
Storage *storage.Driver
|
||||
|
||||
|
|
Loading…
Reference in a new issue