Sha256: 13a2c881f81dc90c10fcd133bf98456a9d984c97484b66569ed9efcddb77c3c7

Contents?: true

Size: 724 Bytes

Versions: 2

Compression:

Stored size: 724 Bytes

Contents

module QPush
  module Server
    module Apis
      class Success < Base
        def call
          update_job
          stat_increment
          log_success
          update_history
        end

        private

        def update_job
          @job.mark_success
          @job.delay if @job.delay_job?
        end

        def stat_increment
          Server.redis do |c|
            c.hincrby(Server.keys.stats, 'success', 1)
          end
        end

        def log_success
          Server.log.info("Worker #{Server.worker.id} | Job SUCCESS | #{@job.klass} with ID: #{@job.id} | #{@job.run_time}")
        end

        def update_history
          History.call(@job, true, nil)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qpush-0.1.7 lib/qpush/server/apis/success.rb
qpush-0.1.6 lib/qpush/server/apis/success.rb