Sha256: 846e5394def3d5bd782a77406367a4de562f7fe5774c1746e6856848e0612391

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 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 { |c| c.hincrby(Server.keys[:stats], 'success', 1) }
        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.10 lib/qpush/server/apis/success.rb