From 5d55e8d920cd5969e5cff567ee88afb13f40a1b9 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Sun, 20 Nov 2022 16:33:49 +0000 Subject: [performance] add account block DB cache and remove block query joins (#1085) * add account block DB cache and remove reliance on relational joins * actually include cache key arguments... * add a PutBlock() method which also updates the block cache, update tests accordingly * use `PutBlock` instead of `Put(ctx, block)` * add + use functions for deleting + invalidating blocks Signed-off-by: kim Co-authored-by: tsmethurst --- internal/processing/account/delete.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/processing/account/delete.go') diff --git a/internal/processing/account/delete.go b/internal/processing/account/delete.go index 275806ec3..ebcc0df5c 100644 --- a/internal/processing/account/delete.go +++ b/internal/processing/account/delete.go @@ -99,12 +99,12 @@ func (p *processor) Delete(ctx context.Context, account *gtsmodel.Account, origi // 2. Delete account's blocks l.Trace("deleting account blocks") // first delete any blocks that this account created - if err := p.db.DeleteWhere(ctx, []db.Where{{Key: "account_id", Value: account.ID}}, &[]*gtsmodel.Block{}); err != nil { + if err := p.db.DeleteBlocksByOriginAccountID(ctx, account.ID); err != nil { l.Errorf("error deleting blocks created by account: %s", err) } // now delete any blocks that target this account - if err := p.db.DeleteWhere(ctx, []db.Where{{Key: "target_account_id", Value: account.ID}}, &[]*gtsmodel.Block{}); err != nil { + if err := p.db.DeleteBlocksByTargetAccountID(ctx, account.ID); err != nil { l.Errorf("error deleting blocks targeting account: %s", err) } -- cgit v1.2.3