You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was helping a friend implement watchdog notifications, and noticed that, unlike sd_watchdog_enabled(3), this gem doesn’t have a way to get the configured watchdog interval. Instead, pretty much every Ruby gem or app I’ve seen use this has to implement the same pattern:
defdo_watchdogreturnunlessSdNotify.watchdog?# Divide by 1,000,000 since 99% of Ruby tooling uses seconds, not microseconds.interval=Integer(ENV.fetch('WATCHDOG_USEC')) / 1_000_000.0loopdoSdNotify.watchdogsleepintervalendend
It would be much more convenient (and require less digging around to learn the environment variables) if this gem exposed a method to get the watchdog interval:
Return 0 (or maybe -1?) if the watchdog is not expecting notifications (that is, if SdNotify.watchdog? would have returned false).
Return the number of seconds as a float instead of the number of microseconds as an integer, since almost all use cases will involve doing this anyway.
Activity
agis commentedon Jun 26, 2024
Sounds like a good idea! Any interested in submitting a PR?
Add `watchdog_interval` method and tests
Mr0grog commentedon Jun 26, 2024
Done! #11
Mr0grog commentedon Jul 26, 2024
Hi @agis, this is just a friendly reminder that I posted a PR for this about a month ago: #11. Not sure if you saw it.