diff options
| author | 2023-07-31 11:25:29 +0100 | |
|---|---|---|
| committer | 2023-07-31 11:25:29 +0100 | |
| commit | ed2477ebea4c3ceec5949821f4950db9669a4a15 (patch) | |
| tree | 1038d7abdfc787ddfc1febb326fd38775b189b85 /internal/db/bundb/status.go | |
| parent | [bugfix/frontend] Decode URI component domain before showing on frontend (#2043) (diff) | |
| download | gotosocial-ed2477ebea4c3ceec5949821f4950db9669a4a15.tar.xz | |
[performance] cache follow, follow request and block ID lists (#2027)
Diffstat (limited to 'internal/db/bundb/status.go')
| -rw-r--r-- | internal/db/bundb/status.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/db/bundb/status.go b/internal/db/bundb/status.go index a019216d0..4dc7d8468 100644 --- a/internal/db/bundb/status.go +++ b/internal/db/bundb/status.go @@ -381,8 +381,6 @@ func (s *statusDB) UpdateStatus(ctx context.Context, status *gtsmodel.Status, co } func (s *statusDB) DeleteStatusByID(ctx context.Context, id string) error { - defer s.state.Caches.GTS.Status().Invalidate("ID", id) - // Load status into cache before attempting a delete, // as we need it cached in order to trigger the invalidate // callback. This in turn invalidates others. @@ -397,6 +395,9 @@ func (s *statusDB) DeleteStatusByID(ctx context.Context, id string) error { return err } + // On return ensure status invalidated from cache. + defer s.state.Caches.GTS.Status().Invalidate("ID", id) + return s.db.RunInTx(ctx, func(tx bun.Tx) error { // delete links between this status and any emojis it uses if _, err := tx. |
