Is sleep precise enough?

This page summarizes the projects mentioned and recommended in the original post on /r/ruby

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • Whenever

    Cron jobs in Ruby

  • There are multiple ways to achieve this. Probably the simplest and most reliable is to rely on cron to run your process every minute. Cron keeps track of time and executes your script each minute. This has the added benefit of avoiding a long running process (which can have its own issues). You can even have your script install it’s own cron job using the Whenever gem.

  • ruby-timeout-interrupt

    Discontinued Timeout-lib, which interrupts everything, also systemcalls. It uses libc-alarm.

  • You might be interested in using timeout-interrupt which uses the alarm syscall which causes the kernel to send the process a SIGALRM signal after the specified amount of seconds.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • monotime

    A sensible interface to monotonic time in Ruby

  • Monotime's README mentions a pattern for a loop that makes some effort to take into account its own execution time, though it does still drift slightly. I should probably offer a more precise example, like I will here:

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts