mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
Dispatch restarting status immediately when job starts
Set proxy status to 'restarting' and dispatch ProxyStatusChangedUI event at the very beginning of handle() method, before StopProxy runs. This notifies the UI immediately so users know a restart is in progress, rather than waiting until after the stop operation completes. Also simplified unit tests to focus on testable job configuration (middleware, tries, timeout) without complex SchemalessAttributes mocking. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,11 @@ class RestartProxyJob implements ShouldBeEncrypted, ShouldQueue
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
// Set status to restarting and notify UI immediately
|
||||
$this->server->proxy->status = 'restarting';
|
||||
$this->server->save();
|
||||
ProxyStatusChangedUI::dispatch($this->server->team_id);
|
||||
|
||||
// Stop proxy
|
||||
StopProxy::run($this->server, restarting: true);
|
||||
|
||||
@@ -41,15 +46,14 @@ class RestartProxyJob implements ShouldBeEncrypted, ShouldQueue
|
||||
$this->server->proxy->force_stop = false;
|
||||
$this->server->save();
|
||||
|
||||
// Start proxy asynchronously - the ProxyStatusChanged event will be dispatched
|
||||
// when the remote process completes, which triggers ProxyStatusChangedNotification
|
||||
// listener that handles UI updates and Traefik version checks
|
||||
// Start proxy asynchronously - returns Activity immediately
|
||||
// The ProxyStatusChanged event will be dispatched when the remote process completes,
|
||||
// which triggers ProxyStatusChangedNotification listener
|
||||
$activity = StartProxy::run($this->server, force: true, restarting: true);
|
||||
|
||||
// Store activity ID and dispatch event with it so UI can open activity monitor
|
||||
// Dispatch event with activity ID immediately so UI can show logs in real-time
|
||||
if ($activity && is_object($activity)) {
|
||||
$this->activity_id = $activity->id;
|
||||
// Dispatch event with activity ID so the UI can show logs
|
||||
ProxyStatusChangedUI::dispatch($this->server->team_id, $this->activity_id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user