class Pallets::Configuration
Attributes
Backend to use for handling workflows
Arguments used to initialize the backend
Number of seconds to block while waiting for jobs
Number of workers to process jobs
Minimum number of seconds a failed job stays in the given up set. After this period, jobs will be permanently deleted
Maximum number of failed jobs that can be in the given up set. When this number is reached, the oldest jobs will be permanently deleted
Number of seconds allowed for a job to be processed. If a job exceeds this period, it is considered failed, and scheduled to be processed again
Maximum number of failures allowed per job. Can also be configured on a per task basis
Middleware
used to wrap job execution with custom logic. Acts like a stack and accepts callable objects (lambdas, procs, objects that respond to call) that take three arguments: the worker handling the job, the job hash and the context
A minimal example of a middleware is:
->(worker, job, context, &b) { puts 'Hello World!'; b.call }
Number of connections to the backend
Number of seconds at which the scheduler checks whether there are jobs due to be (re)processed. Note that this interval is per process; it might require tweaking in case of running multiple Pallets
instances, so that the backend is not polled too often
Serializer used for jobs
Public Class Methods
# File lib/pallets/configuration.rb, line 52 def initialize @backend = :redis @backend_args = {} @blocking_timeout = 5 @concurrency = 2 @failed_job_lifespan = 7_776_000 # 3 months @failed_job_max_count = 1_000 @job_timeout = 1_800 # 30 minutes @max_failures = 3 @scheduler_polling_interval = 10 @serializer = :json @middleware = default_middleware end
Public Instance Methods
# File lib/pallets/configuration.rb, line 70 def default_middleware Middleware::Stack[ Middleware::JobLogger ] end
# File lib/pallets/configuration.rb, line 66 def pool_size @pool_size || @concurrency + 1 end