ttrss: Fix daemon not running sometimes on startup
-
Sometimes when postgres is not available, the daemon fails to create a database connection. In this case the daemon permanently exits with code 101 instead of trying again.
-
This happens more prominently when booting the system and postgres may not be available. Although tt-rss.service has Wants= and After= on postgres.service, it appears that postgres does not have proper startup notification with systemd.
-
This may also happen in other situations such as when temporarily restarting postgres during upgrades or backup/restore operations.
-
Fix the issue by make the daemon restart after a failure. This seems appropriate because the daemon is coded like a web page to fail and exit on all, even temporary, errors.
Tests:
-
Without the patch, stop postgres@13-main.service. Start tt-rss.service. It will fail permanently and not try to restart.
-
With the patch, daemon-reload systemd. Notice that the intended changes reflect with systemd status. Start the service. It fails. But retries 2 minutes later with failure again. When postgres is started again, the next attempt succeeds.
Signed-off-by: Sunil Mohan Adapa sunil@medhas.org