Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart daemon if its thread shuts down unexpectantly #66

Merged
merged 1 commit into from
May 5, 2015

Conversation

jcredding
Copy link
Member

This updates the Process to restart its Daemon if the daemon
stops unexpectantly. There is a small chance this could happen
since all redis errors are rescued already but its possible for
the daemon thread to crash and the process will keep running. This
changes it so the process periodically checks in on the daemon as
its listening for signals, if the daemon is no longer running, then
the process restarts it. This avoids the strange case where the
process is running but its not running any jobs because the daemon
has stopped but the Process is still waiting for signals.

@kellyredding - Ready for review. I noticed this over the weekend while I was messing with some stuff, but like I mentioned, it's a really minor case but I like it. Most likely, if the daemon is crashing its because I broke something while changing Qs. If we don't like restarting the daemon, the other option is to have the process just exit out if it sees its daemon crashed.

This updates the `Process` to restart its `Daemon` if the daemon
stops unexpectantly. There is a small chance this could happen
since all redis errors are rescued already but its possible for
the daemon thread to crash and the process will keep running. This
changes it so the process periodically checks in on the daemon as
its listening for signals, if the daemon is no longer running, then
the process restarts it. This avoids the strange case where the
process is running but its not running any jobs because the daemon
has stopped but the `Process` is still waiting for signals.
@kellyredding
Copy link
Member

@jcredding good write-up. Like we discussed the odds of this happening seem slim but better safe than sorry. I'm fine with it just restarting the daemon. The worst case would be there is an error in the daemon so every time it restarts it just crashes. The 15 sec timeout should protect in this case though.

I'm good with this 👎

jcredding added a commit that referenced this pull request May 5, 2015
Restart daemon if its thread shuts down unexpectantly
@jcredding jcredding merged commit 50eb5cd into master May 5, 2015
@jcredding jcredding deleted the jcr-restart-daemon branch May 5, 2015 21:37
jcredding added a commit that referenced this pull request May 5, 2015
* Simplify error handler unit tests (#64)
* Ping redis when starting a daemon (#65)
* Restart daemon if its thread shuts down unexpectantly (#66)

/cc @kellyredding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants