mosquito-cr / mosquito

A background task runner for crystal applications supporting periodic (CRON) and manually queued jobs
MIT License
227 stars 24 forks source link

Rescue and safely terminate any runnable on unhandle exception #145

Closed robacarp closed 1 month ago

robacarp commented 1 month ago

fixes #142

The unfortunate placement of the crash in the error message caused mosquito to hang, unable to process any work, but still "running" the sleep loop in the overseer. This patch captures the exception, logs it, and causes mosquito to crash by Crashing the runnable. If it were to happen in an executor, it'll get replaced. Otherwise it'll cause mosquito to terminate.

This will allow third party daemon tooling to monitor and restart mosquito automatically -- monit, systemd, whatever.