@@ -129,24 +129,18 @@ Both the Rake task and standalone executable support the following
129129environment variables:
130130
131131* ` APP_NAME ` - Application name used in procline (` $0 ` ) (default empty)
132- * ` BACKGROUND ` - [ Run in the background] ( #running-in-the-background ) if
133- non-empty (via ` Process.daemon ` , if supported) (default ` false ` )
134- * ` DYNAMIC_SCHEDULE ` - Enables [ dynamic scheduling] ( #dynamic-schedules )
135- if non-empty (default ` false ` )
136- * ` RAILS_ENV ` - Environment to use in procline (` $0 ` ) (default empty)
137- * ` INITIALIZER_PATH ` - Path to a Ruby file that will be loaded * before*
138- requiring ` resque ` and ` resque/scheduler ` (default empty).
139- * ` RESQUE_SCHEDULER_INTERVAL ` - Interval in seconds for checking if a
140- scheduled job must run (coerced with ` Kernel#Float() ` ) (default ` 5 ` )
132+ * ` BACKGROUND ` - [ Run in the background] ( #running-in-the-background ) if non-empty (via ` Process.daemon ` , if supported) (default ` false ` )
133+ * ` DELAYED_REQUEUE_BATCH_SIZE ` - Set the delayed job batch size if enabled (default ` 100 ` ). If ` <= 1 ` , this disables batching.
134+ * ` DISABLE_DELAYED_REQUEUE_BATCH ` - Disable batched delayed job queuing (default ` false ` ) - [ See section below on consequences] ( #batched-delayed-job-and-resque-enqueue-hooks )
135+ * ` DYNAMIC_SCHEDULE ` - Enables [ dynamic scheduling] ( #dynamic-schedules ) if non-empty (default ` false ` )
136+ * ` INITIALIZER_PATH ` - Path to a Ruby file that will be loaded * before* requiring ` resque ` and ` resque/scheduler ` (default empty).
141137* ` LOGFILE ` - Log file name (default empty, meaning ` $stdout ` )
142- * ` LOGFORMAT ` - Log output format to use (either ` 'text' ` , ` 'json' ` or ` 'logfmt' ` ,
143- default ` 'text' ` )
138+ * ` LOGFORMAT ` - Log output format to use (either ` 'text' ` , ` 'json' ` or ` 'logfmt' ` , default ` 'text' ` )
144139* ` PIDFILE ` - If non-empty, write process PID to file (default empty)
145- * ` QUIET ` - Silence most output if non-empty (equivalent to a level of
146- ` MonoLogger::FATAL ` , default ` false ` )
147- * ` VERBOSE ` - Maximize log verbosity if non-empty (equivalent to a level
148- of ` MonoLogger::DEBUG ` , default ` false ` )
149-
140+ * ` QUIET ` - Silence most output if non-empty (equivalent to a level of ` MonoLogger::FATAL ` , default ` false ` )
141+ * ` RAILS_ENV ` - Environment to use in procline (` $0 ` ) (default empty)
142+ * ` RESQUE_SCHEDULER_INTERVAL ` - Interval in seconds for checking if a scheduled job must run (coerced with ` Kernel#Float() ` ) (default ` 5 ` )
143+ * ` VERBOSE ` - Maximize log verbosity if non-empty (equivalent to a level of ` MonoLogger::DEBUG ` , default ` false ` )
150144
151145### Resque Pool integration
152146
@@ -755,6 +749,24 @@ This table explains the version requirements for rufus-scheduler
755749| `~> 4.0` | `~> 3.0` |
756750| `< 4.0` | `~> 2.0` |
757751
752+ # #### Batched delayed job and resque enqueue hooks
753+
754+ Batching delayed job queuing can speed up when per-second job counts grows,
755+ avoiding situations that may cause delayed enqueues to fall behind. This
756+ batching wraps enqueues in a `multi` pipeline, making far fewer roundtrips to
757+ the server.
758+
759+ However, in `redis` gem `>= 4.0`, any operations to redis within the `multi`
760+ block must use the multi handle so that the actions are captured. Resque's hooks
761+ do not currently have a way to pass this around, and so compatibility with other
762+ resque plugins or hooks which access redis at enqueue time is impacted with
763+ batch mode. In these cases, you should consider disabling the batching by setting
764+ the `DISABLE_DELAYED_REQUEUE_BATCH` environment variable to `true`.
765+
766+ Detecting when this occurs can be tricky, you must watch for logs
767+ emitted by your `resque-scheduler` process such as `Redis::CommandError : ERR
768+ MULTI calls can not be nested` or `NoMethodError : undefined method nil? for
769+ <Redis::Future`, and delayed jobs you expect would not be enqueued.
758770
759771# ## Contributing
760772
0 commit comments