diff options
author | 2024-05-02 14:43:00 +0200 | |
---|---|---|
committer | 2024-05-02 13:43:00 +0100 | |
commit | ebec95a52280980caa88b9c8cd92d69c1a7dc164 (patch) | |
tree | afea663a4ed5a5312755c828e104f27ec137a7d6 /internal/processing/workers/util.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/processing/workers/util.go')
-rw-r--r-- | internal/processing/workers/util.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/processing/workers/util.go b/internal/processing/workers/util.go index a01982e1a..780e5ca14 100644 --- a/internal/processing/workers/util.go +++ b/internal/processing/workers/util.go @@ -38,7 +38,7 @@ type utils struct { state *state.State media *media.Processor account *account.Processor - surface *surface + surface *Surface } // wipeStatus encapsulates common logic @@ -245,7 +245,7 @@ func (u *utils) incrementStatusesCount( status *gtsmodel.Status, ) error { // Lock on this account since we're changing stats. - unlock := u.state.AccountLocks.Lock(account.URI) + unlock := u.state.ProcessingLocks.Lock(account.URI) defer unlock() // Populate stats. @@ -276,7 +276,7 @@ func (u *utils) decrementStatusesCount( account *gtsmodel.Account, ) error { // Lock on this account since we're changing stats. - unlock := u.state.AccountLocks.Lock(account.URI) + unlock := u.state.ProcessingLocks.Lock(account.URI) defer unlock() // Populate stats. @@ -310,7 +310,7 @@ func (u *utils) incrementFollowersCount( account *gtsmodel.Account, ) error { // Lock on this account since we're changing stats. - unlock := u.state.AccountLocks.Lock(account.URI) + unlock := u.state.ProcessingLocks.Lock(account.URI) defer unlock() // Populate stats. @@ -339,7 +339,7 @@ func (u *utils) decrementFollowersCount( account *gtsmodel.Account, ) error { // Lock on this account since we're changing stats. - unlock := u.state.AccountLocks.Lock(account.URI) + unlock := u.state.ProcessingLocks.Lock(account.URI) defer unlock() // Populate stats. @@ -373,7 +373,7 @@ func (u *utils) incrementFollowingCount( account *gtsmodel.Account, ) error { // Lock on this account since we're changing stats. - unlock := u.state.AccountLocks.Lock(account.URI) + unlock := u.state.ProcessingLocks.Lock(account.URI) defer unlock() // Populate stats. @@ -402,7 +402,7 @@ func (u *utils) decrementFollowingCount( account *gtsmodel.Account, ) error { // Lock on this account since we're changing stats. - unlock := u.state.AccountLocks.Lock(account.URI) + unlock := u.state.ProcessingLocks.Lock(account.URI) defer unlock() // Populate stats. @@ -436,7 +436,7 @@ func (u *utils) incrementFollowRequestsCount( account *gtsmodel.Account, ) error { // Lock on this account since we're changing stats. - unlock := u.state.AccountLocks.Lock(account.URI) + unlock := u.state.ProcessingLocks.Lock(account.URI) defer unlock() // Populate stats. @@ -465,7 +465,7 @@ func (u *utils) decrementFollowRequestsCount( account *gtsmodel.Account, ) error { // Lock on this account since we're changing stats. - unlock := u.state.AccountLocks.Lock(account.URI) + unlock := u.state.ProcessingLocks.Lock(account.URI) defer unlock() // Populate stats. |