Bläddra i källkod

Update StatusDelete pipeline, dispatch async

Daniel Supernault 2 år sedan
förälder
incheckning
257c094911

+ 1 - 1
app/Http/Controllers/StatusController.php

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

+ 3 - 3
app/Jobs/MediaPipeline/MediaDeletePipeline.php

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

+ 4 - 1
app/Jobs/StatusPipeline/StatusDelete.php

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