Sha256: 1f465c66d74114c0056fa1232579076d4d872b56632b57bfe1b11389605d65f5
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require 'pallets' Pallets.configure do |c| # Harness 4 Pallets workers per process c.concurrency = 4 # The default one, though c.backend = :redis # Useful to connect to a hosted Redis instance. Takes all options `Redis.new` # accepts, like `db`, `timeout`, `host`, `port`, `password`, `sentinels`. # Check https://www.rubydoc.info/github/redis/redis-rb/Redis:initialize for # more details c.backend_args = { url: 'redis://127.0.0.1:6379/1' } # Use a maximum of 10 backend connections (Redis, in this case) c.pool_size = 10 # A tad faster than JSON c.serializer = :msgpack # Allow 10 minutes for a job to process. After this, we assume the job did not # finish and we retry it c.job_timeout = 600 # Jobs will be retried up to 5 times upon failure. After that, they will be # given up. Retry times are exponential and happen after: 7, 22, 87, 262, ... c.max_failures = 5 end class ConfigSavvy < Pallets::Workflow task :volatile task :success => :volatile end class Volatile < Pallets::Task def run raise 'I am ràndomly failing' if [true, false].sample end end class Success < Pallets::Task def run puts 'I am executed after Volatile manages to successfully execute' end end ConfigSavvy.new.run
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pallets-0.3.0 | examples/config_savvy.rb |