summaryrefslogtreecommitdiff
path: root/internal/federation/federatingdb/delete.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-04-28 13:23:11 +0100
committerLibravatar GitHub <noreply@github.com>2022-04-28 13:23:11 +0100
commit420e2fb22bc7aa4967ddadb11e444079efdf5117 (patch)
tree413842c5df646c30a8079671ade5e677e3825fb8 /internal/federation/federatingdb/delete.go
parent[bugfix] Fix possible race condition in federatingdb (#490) (diff)
downloadgotosocial-420e2fb22bc7aa4967ddadb11e444079efdf5117.tar.xz
replace async client API / federator msg processing with worker pools (#497)
* replace async client API / federator msg processing with worker pools * appease our lord-and-saviour, the linter
Diffstat (limited to 'internal/federation/federatingdb/delete.go')
-rw-r--r--internal/federation/federatingdb/delete.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/federation/federatingdb/delete.go b/internal/federation/federatingdb/delete.go
index 7293701aa..bd0184f76 100644
--- a/internal/federation/federatingdb/delete.go
+++ b/internal/federation/federatingdb/delete.go
@@ -44,9 +44,9 @@ func (f *federatingDB) Delete(ctx context.Context, id *url.URL) error {
)
l.Debug("entering Delete")
- receivingAccount, _, fromFederatorChan := extractFromCtx(ctx)
- if receivingAccount == nil || fromFederatorChan == nil {
- // If the receiving account or federator channel wasn't set on the context, that means this request didn't pass
+ receivingAccount, _ := extractFromCtx(ctx)
+ if receivingAccount == nil {
+ // If the receiving account wasn't set on the context, that means this request didn't pass
// through the API, but came from inside GtS as the result of another activity on this instance. That being so,
// we can safely just ignore this activity, since we know we've already processed it elsewhere.
return nil
@@ -61,24 +61,24 @@ func (f *federatingDB) Delete(ctx context.Context, id *url.URL) error {
if err := f.db.DeleteByID(ctx, s.ID, &gtsmodel.Status{}); err != nil {
return fmt.Errorf("DELETE: err deleting status: %s", err)
}
- fromFederatorChan <- messages.FromFederator{
+ f.fedWorker.Queue(messages.FromFederator{
APObjectType: ap.ObjectNote,
APActivityType: ap.ActivityDelete,
GTSModel: s,
ReceivingAccount: receivingAccount,
- }
+ })
}
a, err := f.db.GetAccountByURI(ctx, id.String())
if err == nil {
// it's an account
l.Debugf("uri is for an account with id %s, passing delete message to the processor", a.ID)
- fromFederatorChan <- messages.FromFederator{
+ f.fedWorker.Queue(messages.FromFederator{
APObjectType: ap.ObjectProfile,
APActivityType: ap.ActivityDelete,
GTSModel: a,
ReceivingAccount: receivingAccount,
- }
+ })
}
return nil