Skip to content

Commit decd363

Browse files
jpervillesteveklabnik
authored andcommitted
Use Time#rfc2822 instead of Time#xmlschema to serialize Ruby timestamps,
since some javascript engines like IE's only know how to parse rfc2822 timesteamp strings and not iso8601 (aka 'xmlschema') ones. Conflicts: lib/resque/failure/redis.rb lib/resque/worker.rb
1 parent 928068d commit decd363

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/resque/failure/redis.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Failure
55
class Redis < Base
66
def save
77
data = {
8-
:failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S %Z"),
8+
:failed_at => Time.now.rfc2822,
99
:payload => payload,
1010
:exception => exception.class.to_s,
1111
:error => UTF8Util.clean(exception.to_s),
@@ -31,7 +31,7 @@ def self.clear
3131

3232
def self.requeue(index)
3333
item = all(index)
34-
item['retried_at'] = Time.now.strftime("%Y/%m/%d %H:%M:%S")
34+
item['retried_at'] = Time.now.rfc2822
3535
Resque.redis.lset(:failed, index, Resque.encode(item))
3636
Job.create(item['queue'], item['payload']['class'], *item['payload']['args'])
3737
end

lib/resque/worker.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def unregister_worker
433433
def working_on(job)
434434
data = encode \
435435
:queue => job.queue,
436-
:run_at => Time.now.strftime("%Y/%m/%d %H:%M:%S %Z"),
436+
:run_at => Time.now.rfc2822,
437437
:payload => job.payload
438438
redis.set("worker:#{self}", data)
439439
end
@@ -474,7 +474,7 @@ def started
474474

475475
# Tell Redis we've started
476476
def started!
477-
redis.set("worker:#{self}:started", Time.now.to_s)
477+
redis.set("worker:#{self}:started", Time.now.rfc2822)
478478
end
479479

480480
# Returns a hash explaining the Job we're currently processing, if any.

0 commit comments

Comments
 (0)