diff options
| author | 2025-01-22 12:42:12 +0000 | |
|---|---|---|
| committer | 2025-01-22 13:42:12 +0100 | |
| commit | 0a99901c657909a605a7f1c6a4ede282ba01ce43 (patch) | |
| tree | a8b3f1bba879b051db41b18e1707d0c90e315a20 /internal/federation/federatingdb/db.go | |
| parent | [chore]: Bump github.com/coreos/go-oidc/v3 from 3.11.0 to 3.12.0 (#3662) (diff) | |
| download | gotosocial-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/db.go')
| -rw-r--r-- | internal/federation/federatingdb/db.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/federation/federatingdb/db.go b/internal/federation/federatingdb/db.go index ba10ed98b..230098073 100644 --- a/internal/federation/federatingdb/db.go +++ b/internal/federation/federatingdb/db.go @@ -21,6 +21,7 @@ import ( "context" "net/url" + "codeberg.org/gruf/go-cache/v3/simple" "github.com/superseriousbusiness/activity/pub" "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/filter/interaction" @@ -61,6 +62,10 @@ type federatingDB struct { visFilter *visibility.Filter intFilter *interaction.Filter spamFilter *spam.Filter + + // tracks Activity IDs we have handled creates for, + // for use in the Exists() function during forwarding. + activityIDs simple.Cache[string, struct{}] } // New returns a DB that satisfies the pub.Database @@ -79,5 +84,6 @@ func New( intFilter: intFilter, spamFilter: spamFilter, } + fdb.activityIDs.Init(0, 2048) return &fdb } |
