{"id":20351161,"url":"https://github.com/melnik0v/stqueue","last_synced_at":"2025-10-15T13:51:03.008Z","repository":{"id":142102139,"uuid":"136602366","full_name":"melnik0v/stqueue","owner":"melnik0v","description":"Separate Threaded Queues for Sidekiq Jobs","archived":false,"fork":false,"pushed_at":"2019-02-28T06:49:54.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-17T05:05:25.082Z","etag":null,"topics":["activejob","gem","ruby","ruby-gem","ruby-on-rails","sidekiq"],"latest_commit_sha":null,"homepage":null,"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/melnik0v.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2018-06-08T10:07:12.000Z","updated_at":"2023-09-08T17:41:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"1a9ce4a9-3700-4b25-9cb6-f390c9f9ccc5","html_url":"https://github.com/melnik0v/stqueue","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/melnik0v/stqueue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melnik0v%2Fstqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melnik0v%2Fstqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melnik0v%2Fstqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melnik0v%2Fstqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melnik0v","download_url":"https://codeload.github.com/melnik0v/stqueue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melnik0v%2Fstqueue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279084341,"owners_count":26099827,"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","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"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":["activejob","gem","ruby","ruby-gem","ruby-on-rails","sidekiq"],"created_at":"2024-11-14T22:37:20.653Z","updated_at":"2025-10-15T13:51:02.985Z","avatar_url":"https://github.com/melnik0v.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\n  gem 'stqueue', github: 'melnik0v/stqueue'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nCreate an initializer at `config/initializers/stqueue.rb` and add\n```ruby\n  STQueue.configure do |config|\n    config.enabled = true\n    # default concurrency for all queues\n    config.concurrency = ENV['STQUEUE_CONCURRENCY'] # default 1\n    # log_dir should be a `Pathname`\n    config.log_dir = Rails.root.join('log', 'stqueue')\n    # store_type can be :file or :redis\n    config.store_type = :redis\n    config.redis_url = \"redis://#{ENV['REDIS_URL']}/12\" # default 'redis://localhost:6379/12'\n    # or\n    config.store_type = :file\n    config.pids_dir = Rails.root.join('tmp', 'pids') # for file store\n  end\n```\n\n## Usage\n\nAdd\n```ruby\n  include STQueue::Base\n```\nto `SomeJob`\n\nRun Jobs like:\n```ruby\n  SomeJob.separate_by(key: :some_uniq_key, concurrency: 5).perform_later(args)\n  # or \n  SomeJob.separate_by(key: \"some_uniq_key_#{model.id}\", concurrency: 1).perform_later(args)\n  # or\n  SomeJob.separate_by(key: :some_uniq_key).perform_later(args)\n  # or \n  SomeJob.separate_by(key: [model.id, model.name, Date.current]).perform_later(args)\n```\n\n### Note:\nSTQueue will generate queue name using `:key` attribute and `stqueued_` prefix, e.g.:\n\n`{ key: [19, 'option1', :smth_else] }` =\u003e `stqueued_19_option1_smth_else`\n\nAlso you can start and stop processes manually:\n```ruby\n  STQueue::Process.all     # return all processes\n  STQueue::Process.running # return all running processes\n  STQueue::Process.stopped # return all stopped processes\n  process = STQueue::Process.find_by(queue_name: 'queue_name')\n  process.running? # =\u003e true\n  process.kill     # killing the process and return same object with pid = nil\n  process.start    # starting the process and return same object with pid\n  process.restart  # restarting the process and return same object with updated pid\n  process.delete   # kill and delete the process and return nil\n```\n\nRun `rake stqueue:check` or `STQueue.monitor.health_check!` from code to manually stop processes with empty queues and restart processes with non-empty queues\n\n## Result\n\n`STQueue` started Sidekiq process for each unique `key`.\n\n## Support\n\nTested for Ruby 2.3+, Rails. 5.0+, Sidekiq 4.0+\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelnik0v%2Fstqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelnik0v%2Fstqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelnik0v%2Fstqueue/lists"}