A summary of data about the Ruby ecosystem.

https://github.com/socketry/timers

Pure Ruby timers collections suitable for use with event loops
https://github.com/socketry/timers

Keywords from Contributors

rubygems activerecord mvc activejob rack multithreading background-jobs crash-reporting jobs sidekiq

Last synced: about 21 hours ago
JSON representation

Repository metadata

Pure Ruby timers collections suitable for use with event loops

readme.md

Timers

Collections of one-shot and periodic timers, intended for use with event loops such as async.

Development Status

Installation

Add this line to your application's Gemfile:

gem 'timers'

And then execute:

$ bundle

Or install it yourself as:

$ gem install timers

Usage

Create a new timer group with Timers::Group.new:

require 'timers'

timers = Timers::Group.new

Schedule a proc to run after 5 seconds with Timers::Group#after:

five_second_timer = timers.after(5) { puts "Take five" }

The five_second_timer variable is now bound to a Timers::Timer object. To
cancel a timer, use Timers::Timer#cancel

Once you've scheduled a timer, you can wait until the next timer fires with Timers::Group#wait:

# Waits 5 seconds
timers.wait

# The script will now print "Take five"

You can schedule a block to run periodically with Timers::Group#every:

every_five_seconds = timers.every(5) { puts "Another 5 seconds" }

loop { timers.wait }

You can also schedule a block to run immediately and periodically with Timers::Group#now_and_every:

now_and_every_five_seconds = timers.now_and_every(5) { puts "Now and in another 5 seconds" }

loop { timers.wait }

If you'd like another method to do the waiting for you, e.g. Kernel.select,
you can use Timers::Group#wait_interval to obtain the amount of time to wait. When
a timeout is encountered, you can fire all pending timers with Timers::Group#fire:

loop do
  interval = timers.wait_interval
  ready_readers, ready_writers = select readers, writers, nil, interval

  if ready_readers || ready_writers
    # Handle IO
    ...
  else
    # Timeout!
    timers.fire
  end
end

You can also pause and continue individual timers, or all timers:

paused_timer = timers.every(5) { puts "I was paused" }

paused_timer.pause
10.times { timers.wait } # will not fire paused timer

paused_timer.resume
10.times { timers.wait } # will fire timer

timers.pause
10.times { timers.wait } # will not fire any timers

timers.resume
10.times { timers.wait } # will fire all timers

Contributing

We welcome contributions to this project.

  1. Fork it.
  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 new Pull Request.

Developer Certificate of Origin

In order to protect users of this project, we require all contributors to comply with the Developer Certificate of Origin. This ensures that all contributions are properly licensed and attributed.

Community Guidelines

This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 2 days ago

Total Commits: 245
Total Committers: 32
Avg Commits per committer: 7.656
Development Distribution Score (DDS): 0.62

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Samuel Williams s****s@o****z 93
Tony Arcieri b****e@g****m 77
Wander Hillen w****n@g****m 10
Donovan Keme de@f****k 6
Donovan Keme c****e@e****l 6
Jeremy Hinegardner j****y@c****g 6
Sean Gregory s****s@p****t 5
Utenmiki u****i@g****m 4
Chuck Remes g****t@c****m 4
Tommy Ong Gia Phu t****p@g****m 3
Utenmiki t****3@g****m 3
Olle Jonsson o****n@g****m 3
Ron Evans r****s@g****m 3
Larry Lv l****0@g****m 2
Lin Jen-Shin g****t@g****g 2
Ryunosuke Sato t****s@g****m 2
Yoshiki Takagi y****g@g****m 1
Will Jessop w****l@w****t 1
Vít Ondruch v****h@r****m 1
Tim Smith t****h@c****o 1
Feram f****m@f****o 1
Ryan LeCompte l****e@g****m 1
Peter Goldstein p****n@g****m 1
Patrik Wenger p****r@g****m 1
Nicholas Evans n****s@4****m 1
Mike Bourgeous m****s 1
Lavir the Whiolet L****t@g****m 1
Klaus Trainer k****r@p****e 1
Jesse Cooke j****e@j****m 1
Dimitrij Denissenko d****o@b****m 1
and 2 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 2 months ago

Total issues: 28
Total pull requests: 61
Average time to close issues: 9 months
Average time to close pull requests: 2 months
Total issue authors: 25
Total pull request authors: 33
Average comments per issue: 5.61
Average comments per pull request: 3.79
Merged pull request: 50
Bot issues: 0
Bot pull requests: 2

Past year issues: 1
Past year pull requests: 4
Past year average time to close issues: N/A
Past year average time to close pull requests: 3 months
Past year issue authors: 1
Past year pull request authors: 2
Past year average comments per issue: 0.0
Past year average comments per pull request: 1.0
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 2

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/socketry/timers

Top Issue Authors

  • ioquatix (3)
  • digitalextremist (2)
  • jmwright (1)
  • cpfarher (1)
  • thesamesam (1)
  • PikachuEXE (1)
  • dsisnero (1)
  • WJWH (1)
  • ReubenM (1)
  • jonbramble (1)
  • jimmycuadra (1)
  • brandsr (1)
  • HoneyryderChuck (1)
  • funny-falcon (1)
  • dblock (1)

Top Pull Request Authors

  • ioquatix (11)
  • tarcieri (5)
  • taki (5)
  • nevans (3)
  • chuckremes (3)
  • olleolleolle (3)
  • WJWH (2)
  • dependabot[bot] (2)
  • paddor (2)
  • larrylv (2)
  • fciballero (2)
  • copiousfreetime (1)
  • Atul9 (1)
  • brunoenten (1)
  • ghost (1)

Top Issue Labels

  • bug (1)
  • question (1)

Top Pull Request Labels

  • dependencies (2)
  • enhancement (1)

Package metadata

gem.coop: timers

Pure Ruby one-shot and periodic timers.

  • Homepage: https://github.com/socketry/timers
  • Documentation: http://www.rubydoc.info/gems/timers/
  • Licenses: MIT
  • Latest release: 4.4.0 (published about 1 year ago)
  • Last Synced: 2026-03-01T14:02:02.414Z (2 days ago)
  • Versions: 28
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 197,469,491 Total
  • Docker Downloads: 1,106,682,395
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.05%
    • Docker downloads count: 0.078%
    • Downloads: 0.121%
  • Maintainers (2)
rubygems.org: timers

Pure Ruby one-shot and periodic timers.

  • Homepage: https://github.com/socketry/timers
  • Documentation: http://www.rubydoc.info/gems/timers/
  • Licenses: MIT
  • Latest release: 4.4.0 (published about 1 year ago)
  • Last Synced: 2026-03-02T09:33:02.314Z (1 day ago)
  • Versions: 28
  • Dependent Packages: 70
  • Dependent Repositories: 56,335
  • Downloads: 197,481,583 Total
  • Docker Downloads: 1,106,682,395
  • Rankings:
    • Downloads: 0.096%
    • Docker downloads count: 0.103%
    • Dependent repos count: 0.147%
    • Dependent packages count: 0.413%
    • Average: 1.43%
    • Stargazers count: 3.104%
    • Forks count: 4.72%
  • Maintainers (2)
proxy.golang.org: github.com/socketry/timers

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/socketry/timers#section-documentation
  • Licenses: mit
  • Latest release: v4.4.0+incompatible (published about 1 year ago)
  • Last Synced: 2026-03-02T12:32:57.822Z (about 21 hours ago)
  • Versions: 24
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Stargazers count: 3.053%
    • Forks count: 4.26%
    • Average: 6.913%
    • Dependent packages count: 9.56%
    • Dependent repos count: 10.779%

Dependencies

gems.rb rubygems
  • benchmark-ips >= 0 development
  • ruby-prof >= 0 development
  • bake-bundler >= 0
  • bake-modernize >= 0
timers.gemspec rubygems
  • bundler >= 0 development
  • covered >= 0 development
  • rspec ~> 3.0 development
.github/workflows/test.yaml actions
  • actions/checkout v3 composite
  • ruby/setup-ruby v1 composite

Score: 30.97961098390365