Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new
watchdog_interval
method that returns the current watchdog interval in seconds (or0
if no interval is set). Fixes #6.A few notes here:
I tried to keep this simple by just adding a
watchdog_interval
method and not changing any other code. That said, it might be convenient ifwatchdog?
returnedfalse
if disabled and the interval (instead oftrue
) if enabled. That would work fine for most people (since floats are truthy), but might be subtly breaking if someone is literally comparing the return value totrue
.Revised the docs for
watchdog?
a bit to hopefully make them clearer for users who aren’t already deeply familiar withsd_notify
, instead of focusing on under-the-hood bits like environment variables. Happy to change this back if you don’t like that.Added tests for
watchdog?
since there weren’t any.Added an example of using watchdog to the README. It’s a little complex! Let me know if you have ideas for making it simpler or clearer, or if I should remove it.
When I ran Rubocop, I got a huge number of errors, mostly from cops that are probably new since this gem last received a major update. I went ahead and turned most of them off in the config, although I did add
required_ruby_version
to the gemspec file since that seemed like a good idea. I set the value (>= 2.3.0
>= 2.2.0
) based on the GitHub Actions CI job. Let me know if I should change or remove it.