diff options
author | 2024-05-02 14:43:00 +0200 | |
---|---|---|
committer | 2024-05-02 13:43:00 +0100 | |
commit | ebec95a52280980caa88b9c8cd92d69c1a7dc164 (patch) | |
tree | afea663a4ed5a5312755c828e104f27ec137a7d6 /internal/state/state.go | |
parent | [feature] Page through accounts as moderator (#2881) (diff) | |
download | gotosocial-ebec95a52280980caa88b9c8cd92d69c1a7dc164.tar.xz |
[bugfix] Lock when checking/creating notifs to avoid race (#2890)
* [bugfix] Lock when checking/creating notifs to avoid race
* test notif spam
Diffstat (limited to 'internal/state/state.go')
-rw-r--r-- | internal/state/state.go | 17 |
1 files changed, 9 insertions, 8 deletions
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 |