Combine stop+start into single activity for real-time logs

Instead of calling StopProxy::run() (synchronous) then StartProxy::run()
(async), now we build a single command sequence that includes both stop
and start phases. This creates one Activity immediately via remote_process(),
so the UI receives the activity ID right away and can show logs in real-time
from the very beginning of the restart operation.

Key changes:
- Removed dependency on StopProxy and StartProxy actions
- Build combined command sequence inline in buildRestartCommands()
- Use remote_process() directly which returns Activity immediately
- Increased timeout from 60s to 120s to accommodate full restart
- Activity ID dispatched to UI within milliseconds of job starting

Flow is now:
1. Job starts → sets "restarting" status
2. Commands built synchronously (fast, no SSH)
3. remote_process() creates Activity and dispatches CoolifyTask job
4. Activity ID sent to UI immediately via WebSocket
5. UI opens activity monitor with real-time streaming logs
6. Logs show "Stopping proxy..." then "Starting proxy..." as they happen

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2025-12-03 16:21:26 +01:00
parent 340e42aefd
commit 36da7174d5
2 changed files with 115 additions and 22 deletions

View File

@@ -43,7 +43,7 @@ class RestartProxyJobTest extends TestCase
$job = new RestartProxyJob($server);
$this->assertEquals(1, $job->tries);
$this->assertEquals(60, $job->timeout);
$this->assertEquals(120, $job->timeout);
$this->assertNull($job->activity_id);
}