From ebec95a52280980caa88b9c8cd92d69c1a7dc164 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 2 May 2024 14:43:00 +0200 Subject: [bugfix] Lock when checking/creating notifs to avoid race (#2890) * [bugfix] Lock when checking/creating notifs to avoid race * test notif spam --- internal/processing/status/pin.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/processing/status/pin.go') diff --git a/internal/processing/status/pin.go b/internal/processing/status/pin.go index d0688331b..c4a6fc3b8 100644 --- a/internal/processing/status/pin.go +++ b/internal/processing/status/pin.go @@ -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() { -- cgit v1.2.3