ticker

An `Enumerable` ticker object for Crystal

ticker

A Ticker is an object that yields a Time::Instant on an interval.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      ticker:
        github: jgaskins/ticker
    
  2. Run shards install

Usage

ticker = Ticker.new(interval: 5.seconds)

ticker.each do
  # work to be done every 5 seconds
end

Example: Polling the database for jobs

There is an example showing how to use a Ticker to poll Postgres for background jobs inside examples/job_polling.cr.

Contributing

  1. Fork it (https://github.com/jgaskins/ticker/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

ticker

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 1
  • 19 days ago
  • March 11, 2026
License

MIT License

Links
Synced at

Wed, 11 Mar 2026 03:07:11 GMT

Languages