Fix job dispatch and show log output
All checks were successful
Deploy App / deploy (push) Successful in 11s

This commit is contained in:
2025-09-04 17:38:30 +02:00
parent 6a72b7150b
commit 1565df568d
7 changed files with 45 additions and 15 deletions

View File

@@ -24,16 +24,20 @@ class RunBot implements ShouldQueue
$bot = Bot::findOrFail($this->bot_id);
$log = BotLog::findOrFail($this->log_id);
$log->update([
'status' => 'running',
]);
try {
$class = new $bot->class($bot->config ?? []);
$class->run();
$result = $class->run();
// Update the log entry on success
$log->update([
'finished_at' => now(),
'status' => 'success',
// 'output' => is_string($result) ? $result : json_encode($result, JSON_PRETTY_PRINT),
'output' => is_string($result) ? $result : json_encode($result, JSON_PRETTY_PRINT),
]);
} catch (\Throwable $e) {
// Log the error in the bot log