Update RemoteStatusDelete pipeline

This commit is contained in:
Daniel Supernault 2023-08-01 04:40:39 -06:00
parent ed87ddb923
commit 45be6e10b8
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -51,8 +51,10 @@ class RemoteStatusDelete implements ShouldQueue
*/ */
public $deleteWhenMissingModels = true; public $deleteWhenMissingModels = true;
public $timeout = 900; public $timeout = 90;
public $tries = 2; public $tries = 2;
public $maxExceptions = 1;
public $deleteWhenMissingModels = true;
/** /**
* Create a new job instance. * Create a new job instance.
@ -86,11 +88,6 @@ class RemoteStatusDelete implements ShouldQueue
public function unlinkRemoveMedia($status) public function unlinkRemoveMedia($status)
{ {
Media::whereStatusId($status->id)
->get()
->each(function($media) {
MediaDeletePipeline::dispatch($media);
});
if($status->in_reply_to_id) { if($status->in_reply_to_id) {
$parent = Status::findOrFail($status->in_reply_to_id); $parent = Status::findOrFail($status->in_reply_to_id);
@ -99,8 +96,10 @@ class RemoteStatusDelete implements ShouldQueue
StatusService::del($parent->id); StatusService::del($parent->id);
} }
AccountInterstitial::where('item_type', 'App\Status')
->where('item_id', $status->id)
->delete();
Bookmark::whereStatusId($status->id)->delete(); Bookmark::whereStatusId($status->id)->delete();
CollectionItem::whereObjectType('App\Status') CollectionItem::whereObjectType('App\Status')
->whereObjectId($status->id) ->whereObjectId($status->id)
->get() ->get()
@ -108,32 +107,26 @@ class RemoteStatusDelete implements ShouldQueue
CollectionService::removeItem($col->collection_id, $col->object_id); CollectionService::removeItem($col->collection_id, $col->object_id);
$col->delete(); $col->delete();
}); });
DirectMessage::whereStatusId($status->id)->delete(); DirectMessage::whereStatusId($status->id)->delete();
Like::whereStatusId($status->id)->forceDelete();
Like::whereStatusId($status->id)->delete(); Media::whereStatusId($status->id)
->get()
->each(function($media) {
MediaDeletePipeline::dispatch($media)->onQueue('mmo');
});
MediaTag::where('status_id', $status->id)->delete(); MediaTag::where('status_id', $status->id)->delete();
Mention::whereStatusId($status->id)->forceDelete(); Mention::whereStatusId($status->id)->forceDelete();
Notification::whereItemType('App\Status') Notification::whereItemType('App\Status')
->whereItemId($status->id) ->whereItemId($status->id)
->forceDelete(); ->forceDelete();
Report::whereObjectType('App\Status') Report::whereObjectType('App\Status')
->whereObjectId($status->id) ->whereObjectId($status->id)
->delete(); ->delete();
StatusArchived::whereStatusId($status->id)->delete(); StatusArchived::whereStatusId($status->id)->delete();
StatusHashtag::whereStatusId($status->id)->delete(); StatusHashtag::whereStatusId($status->id)->delete();
StatusView::whereStatusId($status->id)->delete(); StatusView::whereStatusId($status->id)->delete();
Status::whereInReplyToId($status->id)->update(['in_reply_to_id' => null]); Status::whereInReplyToId($status->id)->update(['in_reply_to_id' => null]);
AccountInterstitial::where('item_type', 'App\Status')
->where('item_id', $status->id)
->delete();
$status->delete(); $status->delete();
StatusService::del($status->id, true); StatusService::del($status->id, true);