Performance: Deleting files
MEDIUM IMPACT
This affects server response time and user experience during file deletion operations, impacting backend processing speed and frontend responsiveness.
<?php
use Illuminate\Support\Facades\Storage;
use App\Jobs\DeleteFileJob;
DeleteFileJob::dispatch('uploads/largefile.jpg');
// File deletion handled asynchronously via queued job<?php use Illuminate\Support\Facades\File; File::delete(public_path('uploads/largefile.jpg')); // Called directly in a request without queue or async handling
| Pattern | Server Blocking | Response Delay | User Interaction Impact | Verdict |
|---|---|---|---|---|
| Synchronous File::delete() | Blocks server thread | High delay for large files | Causes slow UI response | [X] Bad |
| Asynchronous queued deletion | Non-blocking | Minimal delay | Smooth user interaction | [OK] Good |