Sha256: 85bf348d09a24892b2b5bbe9287a06672045cc5442ca28eb982c884b7d4c0124

Contents?: true

Size: 611 Bytes

Versions: 14

Compression:

Stored size: 611 Bytes

Contents

module Dynflow
  module Executors

    require 'dynflow/executors/abstract'
    require 'dynflow/executors/parallel'

    # Every time we run a code that can be defined outside of Dynflow,
    # we should wrap it with this method, and we can ensure here to do
    # necessary cleanup, such as cleaning ActiveRecord connections
    def self.run_user_code
      clear_connections = defined?(::ActiveRecord) && ActiveRecord::Base.connected? && ActiveRecord::Base.connection.open_transactions.zero?
      yield
    ensure
      ::ActiveRecord::Base.clear_active_connections! if clear_connections
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dynflow-1.2.0 lib/dynflow/executors.rb
dynflow-1.2.0.pre1 lib/dynflow/executors.rb
dynflow-1.1.6 lib/dynflow/executors.rb
dynflow-1.1.5 lib/dynflow/executors.rb
dynflow-1.1.4 lib/dynflow/executors.rb
dynflow-1.1.3 lib/dynflow/executors.rb
dynflow-1.1.2 lib/dynflow/executors.rb
dynflow-1.1.1 lib/dynflow/executors.rb
dynflow-1.1.0 lib/dynflow/executors.rb
dynflow-1.0.5 lib/dynflow/executors.rb
dynflow-1.0.4 lib/dynflow/executors.rb
dynflow-1.0.3 lib/dynflow/executors.rb
dynflow-1.0.2 lib/dynflow/executors.rb
dynflow-1.0.1 lib/dynflow/executors.rb