Sha256: 7b16e46a762ccaa1191dd3560332a170342577e9bdc81fa1ec8a6d41fd287240

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 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

1 entries across 1 versions & 1 rubygems

Version Path
qpush-0.1.8 lib/qpush/server/apis/success.rb