{"id":15288841,"url":"https://github.com/rnd-soft/timeouter","last_synced_at":"2026-02-26T08:03:45.251Z","repository":{"id":56897775,"uuid":"210289226","full_name":"RND-SOFT/timeouter","owner":"RND-SOFT","description":"[MIRROR] Timeouter is advisory timeout ruby helper without any background threads.","archived":false,"fork":false,"pushed_at":"2023-04-03T15:02:13.000Z","size":23,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-02-20T08:08:26.978Z","etag":null,"topics":["gem","loop","ruby","ruby-on-rails","timer"],"latest_commit_sha":null,"homepage":"https://br.rnds.pro/ruby/timeouter","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RND-SOFT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-23T07:17:30.000Z","updated_at":"2024-08-15T11:17:40.000Z","dependencies_parsed_at":"2024-10-23T01:04:05.444Z","dependency_job_id":null,"html_url":"https://github.com/RND-SOFT/timeouter","commit_stats":{"total_commits":34,"total_committers":1,"mean_commits":34.0,"dds":0.0,"last_synced_commit":"81f3184170501222a0b0eef1823b3578d80b2f5d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RND-SOFT/timeouter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RND-SOFT%2Ftimeouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RND-SOFT%2Ftimeouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RND-SOFT%2Ftimeouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RND-SOFT%2Ftimeouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RND-SOFT","download_url":"https://codeload.github.com/RND-SOFT/timeouter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RND-SOFT%2Ftimeouter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29853035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"online","status_checked_at":"2026-02-26T02:00:06.774Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gem","loop","ruby","ruby-on-rails","timer"],"created_at":"2024-09-30T15:53:22.068Z","updated_at":"2026-02-26T08:03:45.224Z","avatar_url":"https://github.com/RND-SOFT.png","language":"Ruby","readme":"# Timeouter\n\n[![Gem Version](https://badge.fury.io/rb/timeouter.svg)](https://rubygems.org/gems/timeouter)\n[![Gem](https://img.shields.io/gem/dt/timeouter.svg)](https://rubygems.org/gems/timeouter/versions)\n[![YARD](https://badgen.net/badge/YARD/doc/blue)](http://www.rubydoc.info/gems/timeouter)\n\n[![Coverage](https://lysander.rnds.pro/api/v1/badges/timeouter_coverage.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_coverage.html)\n[![Quality](https://lysander.rnds.pro/api/v1/badges/timeouter_quality.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_quality.html)\n[![Outdated](https://lysander.rnds.pro/api/v1/badges/timeouter_outdated.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_outdated.html)\n[![Vulnerabilities](https://lysander.rnds.pro/api/v1/badges/timeouter_vulnerable.svg)](https://lysander.rnds.pro/api/v1/badges/timeouter_vulnerable.html)\n\n\nTimeouter is advisory timeout helper without any background threads.\n\n# Usage\n\nTypical usage scenario:\n\n```ruby\nrequire 'timeouter'\n\nTimeouter::run(3) do |t|\n  sleep 1 # do some work\n\n  puts t.elapsed    # 1.00011811\n  puts t.left       # 1.99985717 or nil if timeout was 0\n  puts t.exhausted? # false or nil if timeout was 0\n  puts t.running?   # true\n  puts t.running!   # true\n\n  sleep 3 # do another work\n\n  puts t.elapsed    # 4.000177464\n  puts t.left       # 0 or nil if timeout was 0\n  puts t.exhausted? # true or nil if timeout was 0\n  puts t.running?   # false\n  puts t.running!   # raise Timeouter::TimeoutError.new('execution expired')\nend\n```\n\nYou can pass exception class and message on creation or on checking:\n\n```ruby\nTimeouter::run(1, eclass: RuntimeError, message: 'error') do |t|\n  sleep 2\n  puts t.running!(eclass: MyError, message: 'myerror')\nend\n```\n\nLoop helper:\n\n```ruby\n# just loop 3 seconds\nTimeouter::loop(3) do |t|\n  puts \"i'am in loop\"\n  sleep 1\nend\n\n# just loop 3 seconds and raise exception then\nTimeouter::loop!(3, eclass: MyError) do |t|\n  puts \"i'am in loop and not raised yet\"\n  sleep 1\nend\n\n# Break the loop after some success and retuel value\nresult = Timeouter::loop!(3) do |t|\n  puts \"i'am in loop and not raised yet\"\n  if t.elapsed \u003e 1\n    puts \"work done breaking loop\"\n    break \"RESULT\"\n  end\n  sleep 1\nend\n```\n\n# Installation\n\nIt's a gem:\n```bash\n  gem install timeouter\n```\nThere's also the wonders of [the Gemfile](http://bundler.io):\n```ruby\n  gem 'timeouter'\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnd-soft%2Ftimeouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnd-soft%2Ftimeouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnd-soft%2Ftimeouter/lists"}