{"id":16643453,"url":"https://github.com/sonots/resque_starter","last_synced_at":"2025-07-26T17:33:46.085Z","repository":{"id":56891986,"uuid":"65351610","full_name":"sonots/resque_starter","owner":"sonots","description":"Start and manage multiple resque workers","archived":false,"fork":false,"pushed_at":"2016-08-29T18:46:47.000Z","size":24,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T19:02:22.701Z","etag":null,"topics":["resque","ruby"],"latest_commit_sha":null,"homepage":"","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/sonots.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-10T04:52:51.000Z","updated_at":"2018-01-04T17:24:07.000Z","dependencies_parsed_at":"2022-08-20T15:20:06.766Z","dependency_job_id":null,"html_url":"https://github.com/sonots/resque_starter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonots%2Fresque_starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonots%2Fresque_starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonots%2Fresque_starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sonots%2Fresque_starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sonots","download_url":"https://codeload.github.com/sonots/resque_starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238961167,"owners_count":19559432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["resque","ruby"],"created_at":"2024-10-12T08:08:38.119Z","updated_at":"2025-02-15T07:32:41.636Z","avatar_url":"https://github.com/sonots.png","language":"Ruby","readme":"# ResqueStarter\n\n[Resque](https://github.com/resque/resque) is widely used Redis-backed Ruby library for creating background jobs. [ResqueStarter](https://github.com/sonots/resque_starter) is a tool to start and manage multiple resque workers supporting graceful shutdown and restart, leveraging the [Copy-on-write (COW)](https://en.wikipedia.org/wiki/Copy-on-write).\n\n```\nPID   COMMAND\n14814 resque_starter # preload app\n14815  \\_ resque:work[1]\n14816  \\_ resque:work[2]\n14817  \\_ resque:work[3]\n```\n\n# Background\n\n[Resque](https://github.com/resque/resque) provides [resque:workers](https://github.com/resque/resque#running-multiple-workers) task to run multiple resque workers, but it is only for development purpose as [code comments](https://github.com/resque/resque/blob/c295da9de0034b20ce79600e9f54fb279695f522/lib/resque/tasks.rb#L23-L38) says.\nIt also provides an example configuration of [god](http://godrb.com/) as [resque.god](https://github.com/resque/resque/blob/c295da9de0034b20ce79600e9f54fb279695f522/examples/god/resque.god), but it does not allow us to leverage Copy-on-write (CoW) to save memory of preloaded application.\n\n# Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'resque_starter'\n```\n\nAnd then execute:\n\n```\n$ bundle\n```\n\nOr install it yourself as:\n\n```\n$ gem install resque_starter\n```\n\n# Configuration\n\nPlease see [example/resque.conf.rb](./example/resque.conf.rb)\n\nYou can configure logger, pid file, number of concurrency, dequeue interval, queue lists.\n\n# Usage\n\n```\nbundle exec resque_starter -c /path/to/resque.conf.rb\n```\n\n# Signals\n\nResque starter responds to a few different signals:\n\n* TERM / INT - Quick shutdown, kills all workers immediately then exit\n* QUIT - Graceful shutdown, waits for workers to finish processing then exit\n* USR1 - Send USR1 to all workers, which immediately kill worker's child but don't exit\n* USR2 - Send USR2 to all workers, which don't start to process any new jobs\n* CONT - Send CONT to all workers, which start to process new jobs again after a USR2\n* TTIN - Increment the number of worker processes by one\n* TTOU - Decrement the number of worker processes by one with QUIT\n\n# Graceful restart\n\nResque starter itself does not support graceful restart, yet. But, graceful restart can be done with [server-starter](https://github.com/sonots/ruby-server-starter).\n\nExample configuration is available at [server-starter/example/resque](https://github.com/sonots/ruby-server-starter/blob/master/example/resque). See `start_server` and `config/resque.conf.rb` files.\n\n**HOW IT WORKS**\n\nOn receiving HUP signal, server starter creates a new `resque_starter` (master) process.\nThe new `resque_starter` (master) process forks a new resque worker.\nOn `after_fork`, send `TTOU` to old `resque_starter` (master) process to gracefully shutdown one old resque worker.\nBy repeating this procedure, new `resque_starter` process can be gracefully restarted.\nThe number of working resque workers will be suppressed up to `concurrency + 1` in this way.\n\n**ILLUSTRATION**\n\nOn bootup:\n\n```\nPID   COMMAND\n14813 server_starter\n14814  \\_ resque_starter\n14815      \\_ resque worker[0]\n14816      \\_ resque worker[1]\n14817      \\_ resque worker[2]\n```\n\nSend HUP:\n\n```\nPID   COMMAND\n14813 server_starter\n14814  \\_ resque_starter (old)\n14815      \\_ resque worker[0] (dies)\n14816      \\_ resque worker[1]\n14817      \\_ resque worker[2]\n14818  \\_ resque_starter (new)\n14819      \\_ resque worker[0]\n```\n\nFinally:\n\n```\nPID   COMMAND\n14813 server_starter\n14818  \\_ resque_starter (new)\n14819      \\_ resque worker[0]\n14820      \\_ resque worker[1]\n14821      \\_ resque worker[2]\n```\n\n# Contributing\n\n1. Fork it ( https://github.com/sonots/resque_starter/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonots%2Fresque_starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsonots%2Fresque_starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsonots%2Fresque_starter/lists"}