All Projects → resque → resque-heroku-signals

resque / resque-heroku-signals

Licence: MIT license
Patch resque to be compatible with Heroku process signaling

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to resque-heroku-signals

Resque Scheduler
A light-weight job scheduling system built on top of Resque
Stars: ✭ 1,713 (+7686.36%)
Mutual labels:  queue, background-jobs
Resque
Resque is a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.
Stars: ✭ 9,031 (+40950%)
Mutual labels:  queue, background-jobs
joobq
JoobQ is a fast, efficient asynchronous reliable job queue and job scheduler library processing. Jobs are submitted to a job queue, where they reside until they are able to be scheduled to run in a computing environment.
Stars: ✭ 26 (+18.18%)
Mutual labels:  queue, background-jobs
yii2-deferred-tasks
Yii2 extension for handling deferred tasks (background cron jobs)
Stars: ✭ 11 (-50%)
Mutual labels:  queue, background-jobs
Qutee
PHP Background Jobs (Tasks) Manager
Stars: ✭ 63 (+186.36%)
Mutual labels:  queue, background-jobs
Node Celery
Celery client for Node.js
Stars: ✭ 648 (+2845.45%)
Mutual labels:  queue, background-jobs
celery.node
Celery task queue client/worker for nodejs
Stars: ✭ 164 (+645.45%)
Mutual labels:  queue, background-jobs
Toro
Multithreaded message processing on Postgres
Stars: ✭ 39 (+77.27%)
Mutual labels:  queue, background-jobs
Coravel
Near-zero config .NET Core micro-framework that makes advanced application features like Task Scheduling, Caching, Queuing, Event Broadcasting, and more a breeze!
Stars: ✭ 1,989 (+8940.91%)
Mutual labels:  queue, background-jobs
legacy-bottlerockets
Node.js high availability queue and scheduler for background job processing
Stars: ✭ 25 (+13.64%)
Mutual labels:  queue, background-jobs
Tieba-Birthday-Spider
百度贴吧生日爬虫,可抓取贴吧内吧友生日,并且在对应日期自动发送祝福
Stars: ✭ 28 (+27.27%)
Mutual labels:  queue
aioScrapy
基于asyncio与aiohttp的异步协程爬虫框架 欢迎Star
Stars: ✭ 34 (+54.55%)
Mutual labels:  queue
beems
a bee-queue based minimalist toolkit for building fast, decentralized, scalable and fault tolerant microservices
Stars: ✭ 33 (+50%)
Mutual labels:  queue
leek
Celery Tasks Monitoring Tool
Stars: ✭ 77 (+250%)
Mutual labels:  queue
deque
A highly optimized double-ended queue
Stars: ✭ 75 (+240.91%)
Mutual labels:  queue
orkid-node
Reliable and modern Redis Streams based task queue for Node.js 🤖
Stars: ✭ 61 (+177.27%)
Mutual labels:  queue
wtsqs
Simplified Node AWS SQS Worker Wrapper
Stars: ✭ 18 (-18.18%)
Mutual labels:  queue
ansible-role-rabbitmq
Ansible Role - RabbitMQ
Stars: ✭ 49 (+122.73%)
Mutual labels:  queue
dynamic-queue
The dynamic queue
Stars: ✭ 17 (-22.73%)
Mutual labels:  queue
shoki
Purely functional data structures in Java
Stars: ✭ 30 (+36.36%)
Mutual labels:  queue

Gem Version Ruby

resque-heroku-signals

This gem patches resque to be compatible with the Heroku platform. Specifically it modifies the UNIX signaling logic to be compatible with the Heroku worker shutdown process.

Read this GitHub comment for more context & details.

The version of this gem corresponds to the version of Resque that it is compatible with.

Installation

Add this line to your application's Gemfile:

gem 'resque-heroku-signals'

Since this gem monkeypatches the Heroku worker the gemspec is locked to a x.x.x version of Resque to ensure the monkeypatched logic is compatible with any changes in the original Resque logic. Issue a PR if this is not compatible with the version of resque you are using.

Determining When a Process Will Shutdown

Heroku sends a TERM signal to a process before hard killing it. If your job communicates with slow external APIs, you may want to make sure you have enough time to receive and handle the response from the external system before executing the API requests.

Ideally, using an idempotency key with each external API request is the best way to ensure that a given API request only runs. However, depending on your application logic this may not be practical and knowing if a process will be terminated in less than 30s by Heroku is a useful tool.

Use Resque.heroku_will_terminate? to determine if Heroku will terminate your process within 30s.

Example Procfile

worker: env QUEUE=* TERM_CHILD=1 INTERVAL=0.1 RESQUE_PRE_SHUTDOWN_TIMEOUT=20 RESQUE_TERM_TIMEOUT=8 bundle exec rake resque:work
  • RESQUE_PRE_SHUTDOWN_TIMEOUT time a job has to finish up before the TermException exception is raised
  • RESQUE_TERM_TIMEOUT time the job has to cleanup & save state
  • Total shutdown time should be less than 30s. This is the time Heroku gives you to cleanup before a SIGKILL is issued
  • INTERVAL seconds to wait between jobs

Also, make you don't buffer logs: important log messages could fail to push to stdout during the worker shutdown process:

$stdout.sync = true

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].