Sha256: c5855a2f717a106489e92d1b579e5791395268b1b78fba53f23eb8baaa247d3d

Contents?: true

Size: 679 Bytes

Versions: 117

Compression:

Stored size: 679 Bytes

Contents

# Make sure no jobs are enqueued from a rolled back
# transaction. Pageflow mainly triggers jobs in conjunction with state
# machine transitions. So this patch ensures state db state and
# enqueued jobs stay in sync.
#
# Note the after_transaction yields immediately if there is no open
# transcation.

require 'ar_after_transaction'
require 'resque'

Resque.class_eval do
  class << self
    alias_method :enqueue_without_transaction, :enqueue
    def enqueue(*args)
      if Resque.inline?
        enqueue_without_transaction(*args)
      else
        ActiveRecord::Base.after_transaction do
          enqueue_without_transaction(*args)
        end
      end
    end
  end
end

Version data entries

117 entries across 115 versions & 2 rubygems

Version Path
pageflow-17.0.4 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-17.0.3 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-17.0.2 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-17.0.1 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-17.0.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-16.2.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-16.1.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-16.0.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.8.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-14.5.2 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.7.1 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.7.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.6.1 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.6.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.5.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.4.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.3.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.2.2 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.2.1 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb
pageflow-15.2.0 lib/generators/pageflow/resque/templates/resque_enqueue_after_commit_patch.rb