lib/sidekiq/cron/job.rb in sidekiq-cron-0.1.7 vs lib/sidekiq/cron/job.rb in sidekiq-cron-0.1.8

- old
+ new

@@ -46,10 +46,11 @@ end #enque cron job to queue def enque! time = Time.now @last_run_time = time + @last_enqueue_time = time Sidekiq::Client.push(@message.is_a?(String) ? Sidekiq.load_json(@message) : @message) save logger.debug { "enqueued #{@name}: #{@message}" } @@ -156,11 +157,11 @@ false end end attr_accessor :name, :cron, :klass, :args, :message - attr_reader :last_run_time + attr_reader :last_run_time, :last_enqueue_time def initialize input_args = {} args = input_args.stringify_keys @name = args["name"] @@ -172,10 +173,11 @@ #set status of job @status = args['status'] || status_from_redis #set last run time @last_run_time = Time.parse(args['last_run_time'].to_s) rescue Time.now + @last_enqueue_time = Time.parse(args['last_enqueue_time'].to_s) rescue nil #get right arguments for job @args = args["args"].nil? ? [] : parse_args( args["args"] ) if args["message"] @@ -245,9 +247,10 @@ cron: @cron, args: @args.is_a?(String) ? @args : Sidekiq.dump_json(@args || []), message: @message.is_a?(String) ? @message : Sidekiq.dump_json(@message || {}), status: @status, last_run_time: @last_run_time, + last_enqueue_time: @last_enqueue_time, } end def errors @errors ||= []