Sha256: c63a2e32acf0e7abc1cb21ee9f5067c14c6e93bbb496415d811473d228443f14

Contents?: true

Size: 601 Bytes

Versions: 17

Compression:

Stored size: 601 Bytes

Contents

require 'sidekiq/extensions/generic_proxy'

module Sidekiq
  module Extensions
    ##
    # Adds a 'delay' method to ActiveRecord to offload arbitrary method
    # execution to Sidekiq.  Examples:
    #
    # User.delay.delete_inactive
    # User.recent_signups.each { |user| user.delay.mark_as_awesome }
    class DelayedModel
      include Sidekiq::Worker

      def perform(yml)
        (target, method_name, args) = YAML.load(yml)
        target.send(method_name, *args)
      end
    end

    module ActiveRecord
      def delay
        Proxy.new(DelayedModel, self)
      end
    end

  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
kulesa-sidekiq-1.2.3 lib/sidekiq/extensions/active_record.rb
kulesa-sidekiq-1.2.2 lib/sidekiq/extensions/active_record.rb
sidekiq-1.2.1 lib/sidekiq/extensions/active_record.rb
sidekiq-1.2.0 lib/sidekiq/extensions/active_record.rb
sidekiq-1.1.4 lib/sidekiq/extensions/active_record.rb
sidekiq-1.1.3 lib/sidekiq/extensions/active_record.rb
sidekiq-1.1.2 lib/sidekiq/extensions/active_record.rb
sidekiq-1.1.1 lib/sidekiq/extensions/active_record.rb
sidekiq-1.1.0 lib/sidekiq/extensions/active_record.rb
sidekiq-1.0.0 lib/sidekiq/extensions/active_record.rb
sidekiq-0.11.2 lib/sidekiq/extensions/active_record.rb
sidekiq-0.11.1 lib/sidekiq/extensions/active_record.rb
sidekiq-0.11.0 lib/sidekiq/extensions/active_record.rb
sidekiq-0.10.1 lib/sidekiq/extensions/active_record.rb
sidekiq-0.10.0 lib/sidekiq/extensions/active_record.rb
sidekiq-0.9.1 lib/sidekiq/extensions/active_record.rb
sidekiq-0.9.0 lib/sidekiq/extensions/active_record.rb