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/state/state.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'internal/state/state.go') diff --git a/internal/state/state.go b/internal/state/state.go index f1eb5a9da..90683acd4 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -42,20 +42,21 @@ type State struct { // DB provides access to the database. DB db.DB - // FedLocks provides access to this state's - // mutex map of per URI federation locks. + // FedLocks provides access to this state's mutex + // map of per URI federation locks, intended for + // use in internal/federation functions. // // Used during account and status dereferencing, - // message processing in the FromFediAPI worker - // functions, and by the go-fed/activity library. + // and by the go-fed/activity library. FedLocks mutexes.MutexMap - // AccountLocks provides access to this state's + // ProcessingLocks provides access to this state's // mutex map of per URI locks, intended for use + // in internal/processing functions, for example // when updating accounts, migrating, approving - // or rejecting an account, changing stats, - // pinned statuses, etc. - AccountLocks mutexes.MutexMap + // or rejecting an account, changing stats or + // pinned statuses, creating notifs, etc. + ProcessingLocks mutexes.MutexMap // Storage provides access to the storage driver. Storage *storage.Driver -- cgit v1.2.3