Fix job dispatch and show log output
All checks were successful
Deploy App / deploy (push) Successful in 11s
All checks were successful
Deploy App / deploy (push) Successful in 11s
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user