Skip to content

Heartbeat Healthcheck

this command exists to detect a not working heartbeat and will notify users, that subscribed for this. Additionally, a new functionally is, that this command will automatically try to restart the crashed workers.

Commands

synqup:heartbeat:healthcheck

Healthcheck

This command runs automatically in the background and will be executed every 10 seconds by the supervisor. Incase the heartbeat crashed because of some error, this command will restart the processes managed by the supervisor if the elapsedTime of the heartbeat exceeds the configured interval and gracePeriod. The values are set inside the .env

.env
HEARTBEAT_INTERVAL=30
HEARTBEAT_GRACE_PERIOD=10
HealthcheckService.php - condition which must be fullfilled to restart workers
 if ($this->heartbeatService->getElapsedTime() > ($this->heartbeatService->getInterval() + $this->heartbeatService->getGracePeriod())) {
    ...
 }

If the condition has been fullfilled, the workers will be restarted and a function gets called, which will search for subscribed users to send its notification about the failed heartbeat.

Conditions that must be fullfilled to get a notification

a user must have the E-Mail Notification enabled by checking the Heartbeat failed label. Additionally the intervals must be set. If the heartbeat threshold exceeds the configured 900 seconds (set in the example) and the last notification has been sent is 120 seconds ago, the user will once again receive a notification mail. Image title

Incase the command couldn`t restart the workers because of an exception, the user will immediately get a notification, if the last notification was by the example, 120 seconds ago. This is to prevent the system spamming the user.