Sha256: e808538fa1769f3629875502da2ffb5020d8ab73acbb3a69ab166ca01719bdaf

Contents?: true

Size: 555 Bytes

Versions: 3

Compression:

Stored size: 555 Bytes

Contents

require "sucker_punch"

module Devise
  module Async
    module Backend
      class SuckerPunch < Base
        include ::SuckerPunch::Job

        def self.enqueue(*args)
          new.async.perform(*args)
        end

        # Return the connection to the pool after we're done with it
        # see: https://github.com/brandonhilkert/sucker_punch#usage
        def perform(method, resource_class, resource_id, *args)
          ActiveRecord::Base.connection_pool.with_connection do
            super
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
devise-async-0.10.2 lib/devise/async/backend/sucker_punch.rb
devise-async-0.10.1 lib/devise/async/backend/sucker_punch.rb
devise-async-0.10.1.alpha lib/devise/async/backend/sucker_punch.rb