Sha256: 81a347344492ddd5f71bcc3d0b1242957e524dec6a92e4520f21306b8b615fc7
Contents?: true
Size: 648 Bytes
Versions: 8
Compression:
Stored size: 648 Bytes
Contents
# Encoding: utf-8 module Qless module Middleware # A module for reconnecting to redis for each job module RedisReconnect def self.new(*redis_connections, &block) Module.new do define_singleton_method :to_s do 'Qless::Middleware::RedisReconnect' end define_singleton_method(:inspect, method(:to_s)) block ||= ->(job) { redis_connections } define_method :around_perform do |job| Array(block.call(job)).each do |redis| redis.client.reconnect end super(job) end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems