summaryrefslogtreecommitdiff
path: root/internal/db/bundb/relationship_follow.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/bundb/relationship_follow.go')
-rw-r--r--internal/db/bundb/relationship_follow.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/internal/db/bundb/relationship_follow.go b/internal/db/bundb/relationship_follow.go
index 84501b0be..3b0597612 100644
--- a/internal/db/bundb/relationship_follow.go
+++ b/internal/db/bundb/relationship_follow.go
@@ -233,8 +233,6 @@ func (r *relationshipDB) deleteFollow(ctx context.Context, id string) error {
}
func (r *relationshipDB) DeleteFollow(ctx context.Context, sourceAccountID string, targetAccountID string) error {
- defer r.state.Caches.GTS.Follow().Invalidate("AccountID.TargetAccountID", sourceAccountID, targetAccountID)
-
// Load follow into cache before attempting a delete,
// as we need it cached in order to trigger the invalidate
// callback. This in turn invalidates others.
@@ -251,13 +249,14 @@ func (r *relationshipDB) DeleteFollow(ctx context.Context, sourceAccountID strin
return err
}
+ // Drop this now-cached follow on return after delete.
+ defer r.state.Caches.GTS.Follow().Invalidate("AccountID.TargetAccountID", sourceAccountID, targetAccountID)
+
// Finally delete follow from DB.
return r.deleteFollow(ctx, follow.ID)
}
func (r *relationshipDB) DeleteFollowByID(ctx context.Context, id string) error {
- defer r.state.Caches.GTS.Follow().Invalidate("ID", id)
-
// Load follow into cache before attempting a delete,
// as we need it cached in order to trigger the invalidate
// callback. This in turn invalidates others.
@@ -270,13 +269,14 @@ func (r *relationshipDB) DeleteFollowByID(ctx context.Context, id string) error
return err
}
+ // Drop this now-cached follow on return after delete.
+ defer r.state.Caches.GTS.Follow().Invalidate("ID", id)
+
// Finally delete follow from DB.
return r.deleteFollow(ctx, follow.ID)
}
func (r *relationshipDB) DeleteFollowByURI(ctx context.Context, uri string) error {
- defer r.state.Caches.GTS.Follow().Invalidate("URI", uri)
-
// Load follow into cache before attempting a delete,
// as we need it cached in order to trigger the invalidate
// callback. This in turn invalidates others.
@@ -289,6 +289,9 @@ func (r *relationshipDB) DeleteFollowByURI(ctx context.Context, uri string) erro
return err
}
+ // Drop this now-cached follow on return after delete.
+ defer r.state.Caches.GTS.Follow().Invalidate("URI", uri)
+
// Finally delete follow from DB.
return r.deleteFollow(ctx, follow.ID)
}
@@ -312,10 +315,9 @@ func (r *relationshipDB) DeleteAccountFollows(ctx context.Context, accountID str
}
defer func() {
- // Invalidate all IDs on return.
- for _, id := range followIDs {
- r.state.Caches.GTS.Follow().Invalidate("ID", id)
- }
+ // Invalidate all account's incoming / outoing follows on return.
+ r.state.Caches.GTS.Follow().Invalidate("AccountID", accountID)
+ r.state.Caches.GTS.Follow().Invalidate("TargetAccountID", accountID)
}()
// Load all follows into cache, this *really* isn't great