mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 14:06:15 +00:00
fix create queue with root user (#409)
* fix create queue with root user * fix * fix queues for root user
This commit is contained in:
@ -5,6 +5,8 @@
|
||||
use App\Enums\QueueStatus;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* @property int $server_id
|
||||
@ -62,7 +64,11 @@ public static function boot(): void
|
||||
parent::boot();
|
||||
|
||||
static::deleting(function (Queue $queue) {
|
||||
$queue->server->processManager()->handler()->delete($queue->id, $queue->site_id);
|
||||
try {
|
||||
$queue->server->processManager()->handler()->delete($queue->id, $queue->site_id);
|
||||
} catch (Throwable $e) {
|
||||
Log::error($e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -89,6 +95,10 @@ public function site(): BelongsTo
|
||||
|
||||
public function getLogDirectory(): string
|
||||
{
|
||||
if ($this->user === 'root') {
|
||||
return '/root/.logs/workers';
|
||||
}
|
||||
|
||||
return '/home/'.$this->user.'/.logs/workers';
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user