summaryrefslogtreecommitdiff
path: root/internal/federation/federatingdb/create.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2025-01-22 12:42:12 +0000
committerLibravatar GitHub <noreply@github.com>2025-01-22 13:42:12 +0100
commit0a99901c657909a605a7f1c6a4ede282ba01ce43 (patch)
treea8b3f1bba879b051db41b18e1707d0c90e315a20 /internal/federation/federatingdb/create.go
parent[chore]: Bump github.com/coreos/go-oidc/v3 from 3.11.0 to 3.12.0 (#3662) (diff)
downloadgotosocial-0a99901c657909a605a7f1c6a4ede282ba01ce43.tar.xz
[performance] reduce InboxForward->Create calls by partially implementing Exists() (#3647)
* alphabetical reordering * keep a cache of activity IDs we have handled creates for * reduce number of inbox forwarding create calls by partially implementing Exists() * increase cache size, since all we're storing is string keys
Diffstat (limited to 'internal/federation/federatingdb/create.go')
-rw-r--r--internal/federation/federatingdb/create.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/federation/federatingdb/create.go b/internal/federation/federatingdb/create.go
index 60232efe3..11030b16b 100644
--- a/internal/federation/federatingdb/create.go
+++ b/internal/federation/federatingdb/create.go
@@ -63,6 +63,10 @@ func (f *federatingDB) Create(ctx context.Context, asType vocab.Type) error {
return nil
}
+ // Cache entry for this create activity ID for later
+ // checks in the Exist() function if we see it again.
+ f.activityIDs.Set(ap.GetJSONLDId(asType).String(), struct{}{})
+
switch name := asType.GetTypeName(); name {
case ap.ActivityBlock:
// BLOCK SOMETHING