Skip to content

Commit

Permalink
Differentiate exit codes for paused and inactive horizon status (#1471)
Browse files Browse the repository at this point in the history
For our Docker setup, we use the `horizon:status` command for the health check. So if Horizon fails to load or crashes, it starts a new container.

Now we pause the running Horizon processes before we push an update. This way we can update the web image and launch a new Horizon image, without an old Horizon image complaining about jobs it doesn't understand (new job created in new image code for example).

But now that we added the health checks for the Horizon images too, the image is being replaced with a new instance of the old image immediately, because the paused status triggers the failing exit code of the status command (which is oke, because it is not running indeed).
To determine if the Horizon is just paused or actually inactive, it would be nice if we had different exit codes. This way we can check for exit code 2 to relaunch the existing image in  a new container. and leave the paused containers "running".

This could break other peoples script, based on a specific exit code, tho a basic non success check should suffice for the old and new way. So I'm not sure if we can push this without any minor version increase or whatsoever.
  • Loading branch information
CanvasCompanyHylke committed Jul 5, 2024
1 parent a22eef6 commit 81e62ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Console/StatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle(MasterSupervisorRepository $masterSupervisorRepository)
if (! $masters = $masterSupervisorRepository->all()) {
$this->components->error('Horizon is inactive.');

return 1;
return 2;
}

if (collect($masters)->contains(function ($master) {
Expand Down

0 comments on commit 81e62ce

Please sign in to comment.