summaryrefslogtreecommitdiff
path: root/internal/federation/federatingdb/lock.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-10-31 11:12:22 +0000
committerLibravatar GitHub <noreply@github.com>2023-10-31 11:12:22 +0000
commitce71a5a7902963538fc54583588850563f6746cc (patch)
tree3e869eba6d25d2db5fe81184ffee595e451b3147 /internal/federation/federatingdb/lock.go
parent[bugfix] Relax `Mention` parsing, allowing either href or name (#2320) (diff)
downloadgotosocial-ce71a5a7902963538fc54583588850563f6746cc.tar.xz
[feature] add per-uri dereferencer locks (#2291)
Diffstat (limited to 'internal/federation/federatingdb/lock.go')
-rw-r--r--internal/federation/federatingdb/lock.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/internal/federation/federatingdb/lock.go b/internal/federation/federatingdb/lock.go
index 900a282af..5353aea91 100644
--- a/internal/federation/federatingdb/lock.go
+++ b/internal/federation/federatingdb/lock.go
@@ -19,7 +19,6 @@ package federatingdb
import (
"context"
- "errors"
"net/url"
)
@@ -35,9 +34,5 @@ import (
//
// Used to ensure race conditions in multiple requests do not occur.
func (f *federatingDB) Lock(c context.Context, id *url.URL) (func(), error) {
- if id == nil {
- return nil, errors.New("Lock: id was nil")
- }
- unlock := f.locks.Lock(id.String())
- return unlock, nil
+ return f.state.FedLocks.Lock("federatingDB " + id.String()), nil // id should NEVER be nil.
}