summaryrefslogtreecommitdiff
path: root/internal/db/bundb/status.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/bundb/status.go')
-rw-r--r--internal/db/bundb/status.go5
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.