Sha256: ebc9fc05031b19adadd9c138238de6b2a410237c8248fddd2ad0db7e6523027d

Contents?: true

Size: 1.09 KB

Versions: 28

Compression:

Stored size: 1.09 KB

Contents

require 'active_support/rescuable'
require 'active_job/arguments'

module ActiveJob
  module Execution
    extend ActiveSupport::Concern
    include ActiveSupport::Rescuable

    # Includes methods for executing and performing jobs instantly.
    module ClassMethods
      # Performs the job immediately.
      #
      #   MyJob.perform_now("mike")
      #
      def perform_now(*args)
        job_or_instantiate(*args).perform_now
      end

      def execute(job_data) #:nodoc:
        ActiveJob::Callbacks.run_callbacks(:execute) do
          job = deserialize(job_data)
          job.perform_now
        end
      end
    end

    # Performs the job immediately. The job is not sent to the queueing adapter
    # but directly executed by blocking the execution of others until it's finished.
    #
    #   MyJob.new(*args).perform_now
    def perform_now
      deserialize_arguments_if_needed
      run_callbacks :perform do
        perform(*arguments)
      end
    rescue => exception
      rescue_with_handler(exception) || raise
    end

    def perform(*)
      fail NotImplementedError
    end
  end
end

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
activejob-5.0.7.2 lib/active_job/execution.rb
activejob-5.0.7.1 lib/active_job/execution.rb
activejob-5.0.7 lib/active_job/execution.rb
activejob-5.0.6 lib/active_job/execution.rb
activejob-5.0.6.rc1 lib/active_job/execution.rb
activejob-5.0.5 lib/active_job/execution.rb
activejob-5.0.5.rc2 lib/active_job/execution.rb
activejob-5.0.5.rc1 lib/active_job/execution.rb
activejob-5.0.4 lib/active_job/execution.rb
activejob-5.0.4.rc1 lib/active_job/execution.rb
activejob-5.0.3 lib/active_job/execution.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activejob-5.0.2/lib/active_job/execution.rb
activejob-5.0.2 lib/active_job/execution.rb
activejob-5.0.2.rc1 lib/active_job/execution.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/execution.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/execution.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/execution.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/execution.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/execution.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.1/lib/active_job/execution.rb