Update StatusDelete pipeline, dispatch async

This commit is contained in:
Daniel Supernault 2022-12-26 20:04:42 -07:00
parent 7bcf3e0334
commit 257c094911
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 8 additions and 5 deletions

View file

@ -225,7 +225,7 @@ class StatusController extends Controller
StatusService::del($status->id, true); StatusService::del($status->id, true);
if ($status->profile_id == $user->profile->id || $user->is_admin == true) { if ($status->profile_id == $user->profile->id || $user->is_admin == true) {
Cache::forget('profile:status_count:'.$status->profile_id); Cache::forget('profile:status_count:'.$status->profile_id);
StatusDelete::dispatchNow($status); StatusDelete::dispatch($status);
} }
if($request->wantsJson()) { if($request->wantsJson()) {

View file

@ -41,7 +41,7 @@ class MediaDeletePipeline implements ShouldQueue
array_pop($e); array_pop($e);
$i = implode('/', $e); $i = implode('/', $e);
if(config('pixelfed.cloud_storage') == true) { if(config_cache('pixelfed.cloud_storage') == true) {
$disk = Storage::disk(config('filesystems.cloud')); $disk = Storage::disk(config('filesystems.cloud'));
if($path && $disk->exists($path)) { if($path && $disk->exists($path)) {
@ -63,9 +63,9 @@ class MediaDeletePipeline implements ShouldQueue
$disk->delete($thumb); $disk->delete($thumb);
} }
$media->forceDelete(); $media->delete();
return; return 1;
} }
} }

View file

@ -50,6 +50,9 @@ class StatusDelete implements ShouldQueue
*/ */
public $deleteWhenMissingModels = true; public $deleteWhenMissingModels = true;
public $timeout = 900;
public $tries = 2;
/** /**
* Create a new job instance. * Create a new job instance.
* *
@ -131,7 +134,7 @@ class StatusDelete implements ShouldQueue
->where('item_id', $status->id) ->where('item_id', $status->id)
->delete(); ->delete();
$status->forceDelete(); $status->delete();
return 1; return 1;
} }