summaryrefslogtreecommitdiff
path: root/internal/processing/account/delete.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-07-10 16:18:21 +0100
committerLibravatar GitHub <noreply@github.com>2022-07-10 17:18:21 +0200
commit7cc40302a578264dff4edb3b007fc192b840c7d4 (patch)
tree82d78254373f1c18fdd6271aa324100cedaacc2d /internal/processing/account/delete.go
parent[bugfix] Fix display names in thread view causing wrapping issues on small sc... (diff)
downloadgotosocial-7cc40302a578264dff4edb3b007fc192b840c7d4.tar.xz
[chore] consolidate caching libraries (#704)
* add miekg/dns dependency * set/validate accountDomain * move finger to dereferencer * totally break GetRemoteAccount * start reworking finger func a bit * start reworking getRemoteAccount a bit * move mention parts to namestring * rework webfingerget * use util function to extract webfinger parts * use accountDomain * rework finger again, final form * just a real nasty commit, the worst * remove refresh from account * use new ASRepToAccount signature * fix incorrect debug call * fix for new getRemoteAccount * rework GetRemoteAccount * start updating tests to remove repetition * break a lot of tests Move shared test logic into the testrig, rather than having it scattered all over the place. This allows us to just mock the transport controller once, and have all tests use it (unless they need not to for some other reason). * fix up tests to use main mock httpclient * webfinger only if necessary * cheeky linting with the lads * update mentionName regex recognize instance accounts * don't finger instance accounts * test webfinger part extraction * increase default worker count to 4 per cpu * don't repeat regex parsing * final search for discovered accountDomain * be more permissive in namestring lookup * add more extraction tests * simplify GetParseMentionFunc * skip long search if local account * fix broken test * consolidate to all use same caching libraries Signed-off-by: kim <grufwub@gmail.com> * perform more caching in the database layer Signed-off-by: kim <grufwub@gmail.com> * remove ASNote cache Signed-off-by: kim <grufwub@gmail.com> * update cache library, improve db tracing hooks Signed-off-by: kim <grufwub@gmail.com> * return ErrNoEntries if no account status IDs found, small formatting changes Signed-off-by: kim <grufwub@gmail.com> * fix tests, thanks tobi! Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/processing/account/delete.go')
-rw-r--r--internal/processing/account/delete.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/internal/processing/account/delete.go b/internal/processing/account/delete.go
index 5b40804d8..67192cb8f 100644
--- a/internal/processing/account/delete.go
+++ b/internal/processing/account/delete.go
@@ -145,11 +145,12 @@ selectStatusesLoop:
for {
statuses, err := p.db.GetAccountStatuses(ctx, account.ID, 20, false, false, maxID, "", false, false, false)
if err != nil {
- if err == db.ErrNoEntries {
+ if errors.Is(err, db.ErrNoEntries) {
// no statuses left for this instance so we're done
l.Infof("Delete: done iterating through statuses for account %s", account.Username)
break selectStatusesLoop
}
+
// an actual error has occurred
l.Errorf("Delete: db error selecting statuses for account %s: %s", account.Username, err)
break selectStatusesLoop
@@ -158,6 +159,7 @@ selectStatusesLoop:
for i, s := range statuses {
// pass the status delete through the client api channel for processing
s.Account = account
+
l.Debug("putting status in the client api channel")
p.clientWorker.Queue(messages.FromClientAPI{
APObjectType: ap.ObjectNote,
@@ -168,20 +170,20 @@ selectStatusesLoop:
})
if err := p.db.DeleteByID(ctx, s.ID, s); err != nil {
- if err != db.ErrNoEntries {
+ if !errors.Is(err, db.ErrNoEntries) {
// actual error has occurred
- l.Errorf("Delete: db error status %s for account %s: %s", s.ID, account.Username, err)
- break selectStatusesLoop
+ l.Errorf("Delete: db error deleting status %s for account %s: %s", s.ID, account.Username, err)
+ continue
}
}
// if there are any boosts of this status, delete them as well
boosts := []*gtsmodel.Status{}
if err := p.db.GetWhere(ctx, []db.Where{{Key: "boost_of_id", Value: s.ID}}, &boosts); err != nil {
- if err != db.ErrNoEntries {
+ if !errors.Is(err, db.ErrNoEntries) {
// an actual error has occurred
l.Errorf("Delete: db error selecting boosts of status %s for account %s: %s", s.ID, account.Username, err)
- break selectStatusesLoop
+ continue
}
}
@@ -189,8 +191,10 @@ selectStatusesLoop:
if b.Account == nil {
bAccount, err := p.db.GetAccountByID(ctx, b.AccountID)
if err != nil {
+ l.Errorf("Delete: db error populating boosted status account: %v", err)
continue
}
+
b.Account = bAccount
}
@@ -207,7 +211,7 @@ selectStatusesLoop:
if err != db.ErrNoEntries {
// actual error has occurred
l.Errorf("Delete: db error deleting boost with id %s: %s", b.ID, err)
- break selectStatusesLoop
+ continue
}
}
}