move queue invalidation to before wipeing / deletion, to ensure queued work not dropped
This commit is contained in:
parent
1d1d80ed11
commit
a055c5f749
|
@ -633,14 +633,6 @@ func (p *clientAPI) DeleteStatus(ctx context.Context, cMsg *messages.FromClientA
|
|||
return gtserror.Newf("db error populating status: %w", err)
|
||||
}
|
||||
|
||||
// First perform the actual status deletion.
|
||||
if err := p.utils.wipeStatus(ctx, status, deleteAttachments); err != nil {
|
||||
log.Errorf(ctx, "error wiping status: %v", err)
|
||||
}
|
||||
|
||||
// Now status is deleted, first thing we do is drop any
|
||||
// queued work relating to it ASAP to prevent wasted work.
|
||||
|
||||
// Drop any outgoing queued AP requests about / targeting
|
||||
// this status, (stops queued likes, boosts, creates etc).
|
||||
p.state.Workers.Delivery.Queue.Delete("ObjectID", status.URI)
|
||||
|
@ -654,6 +646,11 @@ func (p *clientAPI) DeleteStatus(ctx context.Context, cMsg *messages.FromClientA
|
|||
// (stops processing of remote origin data targeting this status).
|
||||
p.state.Workers.Federator.Queue.Delete("TargetURI", status.URI)
|
||||
|
||||
// First perform the actual status deletion.
|
||||
if err := p.utils.wipeStatus(ctx, status, deleteAttachments); err != nil {
|
||||
log.Errorf(ctx, "error wiping status: %v", err)
|
||||
}
|
||||
|
||||
// Update stats for the origin account.
|
||||
if err := p.utils.decrementStatusesCount(ctx, cMsg.Origin); err != nil {
|
||||
log.Errorf(ctx, "error updating account stats: %v", err)
|
||||
|
@ -692,14 +689,6 @@ func (p *clientAPI) DeleteAccount(ctx context.Context, cMsg *messages.FromClient
|
|||
// Extract target account.
|
||||
account := cMsg.Target
|
||||
|
||||
// First perform the actual account deletion.
|
||||
if err := p.account.Delete(ctx, cMsg.Target, originID); err != nil {
|
||||
log.Errorf(ctx, "error deleting account: %v", err)
|
||||
}
|
||||
|
||||
// Now account is deleted, first thing we do is drop any
|
||||
// queued work relating to it ASAP to prevent wasted work.
|
||||
|
||||
// Drop any outgoing queued AP requests to / from / targeting
|
||||
// this account, (stops queued likes, boosts, creates etc).
|
||||
p.state.Workers.Delivery.Queue.Delete("ActorID", account.URI)
|
||||
|
@ -717,6 +706,11 @@ func (p *clientAPI) DeleteAccount(ctx context.Context, cMsg *messages.FromClient
|
|||
p.state.Workers.Federator.Queue.Delete("Receiving.ID", account.ID)
|
||||
p.state.Workers.Federator.Queue.Delete("TargetURI", account.URI)
|
||||
|
||||
// First perform the actual account deletion.
|
||||
if err := p.account.Delete(ctx, cMsg.Target, originID); err != nil {
|
||||
log.Errorf(ctx, "error deleting account: %v", err)
|
||||
}
|
||||
|
||||
if err := p.federate.DeleteAccount(ctx, cMsg.Target); err != nil {
|
||||
log.Errorf(ctx, "error federating account delete: %v", err)
|
||||
}
|
||||
|
|
|
@ -611,14 +611,6 @@ func (p *fediAPI) DeleteStatus(ctx context.Context, fMsg *messages.FromFediAPI)
|
|||
return gtserror.Newf("db error populating status: %w", err)
|
||||
}
|
||||
|
||||
// First perform the actual status deletion.
|
||||
if err := p.utils.wipeStatus(ctx, status, deleteAttachments); err != nil {
|
||||
log.Errorf(ctx, "error wiping status: %v", err)
|
||||
}
|
||||
|
||||
// Now status is deleted, first thing we do is drop any
|
||||
// queued work relating to it ASAP to prevent wasted work.
|
||||
|
||||
// Drop any outgoing queued AP requests about / targeting
|
||||
// this status, (stops queued likes, boosts, creates etc).
|
||||
p.state.Workers.Delivery.Queue.Delete("ObjectID", status.URI)
|
||||
|
@ -632,6 +624,11 @@ func (p *fediAPI) DeleteStatus(ctx context.Context, fMsg *messages.FromFediAPI)
|
|||
// (stops processing of remote origin data targeting this status).
|
||||
p.state.Workers.Federator.Queue.Delete("TargetURI", status.URI)
|
||||
|
||||
// First perform the actual status deletion.
|
||||
if err := p.utils.wipeStatus(ctx, status, deleteAttachments); err != nil {
|
||||
log.Errorf(ctx, "error wiping status: %v", err)
|
||||
}
|
||||
|
||||
// Update stats for the remote account.
|
||||
if err := p.utils.decrementStatusesCount(ctx, fMsg.Requesting); err != nil {
|
||||
log.Errorf(ctx, "error updating account stats: %v", err)
|
||||
|
@ -652,14 +649,6 @@ func (p *fediAPI) DeleteAccount(ctx context.Context, fMsg *messages.FromFediAPI)
|
|||
return gtserror.Newf("%T not parseable as *gtsmodel.Account", fMsg.GTSModel)
|
||||
}
|
||||
|
||||
// First perform the actual account deletion.
|
||||
if err := p.account.Delete(ctx, account, account.ID); err != nil {
|
||||
log.Errorf(ctx, "error deleting account: %v", err)
|
||||
}
|
||||
|
||||
// Now account is deleted, first thing we do is drop any
|
||||
// queued work relating to it ASAP to prevent wasted work.
|
||||
|
||||
// Drop any outgoing queued AP requests to / from / targeting
|
||||
// this account, (stops queued likes, boosts, creates etc).
|
||||
p.state.Workers.Delivery.Queue.Delete("ObjectID", account.URI)
|
||||
|
@ -675,5 +664,10 @@ func (p *fediAPI) DeleteAccount(ctx context.Context, fMsg *messages.FromFediAPI)
|
|||
p.state.Workers.Federator.Queue.Delete("Requesting.ID", account.ID)
|
||||
p.state.Workers.Federator.Queue.Delete("TargetURI", account.URI)
|
||||
|
||||
// First perform the actual account deletion.
|
||||
if err := p.account.Delete(ctx, account, account.ID); err != nil {
|
||||
log.Errorf(ctx, "error deleting account: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue