[bugfix] Lock when checking/creating notifs to avoid race (#2890)

* [bugfix] Lock when checking/creating notifs to avoid race

* test notif spam
This commit is contained in:
tobi 2024-05-02 14:43:00 +02:00 committed by GitHub
commit ebec95a522
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 290 additions and 133 deletions

View file

@ -83,7 +83,7 @@ func (p *Processor) PinCreate(ctx context.Context, requestingAccount *gtsmodel.A
}
// Get a lock on this account.
unlock := p.state.AccountLocks.Lock(requestingAccount.URI)
unlock := p.state.ProcessingLocks.Lock(requestingAccount.URI)
defer unlock()
if !targetStatus.PinnedAt.IsZero() {
@ -148,7 +148,7 @@ func (p *Processor) PinRemove(ctx context.Context, requestingAccount *gtsmodel.A
}
// Get a lock on this account.
unlock := p.state.AccountLocks.Lock(requestingAccount.URI)
unlock := p.state.ProcessingLocks.Lock(requestingAccount.URI)
defer unlock()
if targetStatus.PinnedAt.IsZero() {