Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More feedback

  • Loading branch information...
commit 0e60e8878378f29f63e8d7e5ee0455e011ac3840 1 parent 897f86b
Mike Perham mperham authored
10 lib/active_job/enqueuing.rb
View
@@ -2,7 +2,7 @@
module ActiveJob
module Enqueuing
- #
+
# Push a job onto the queue. The arguments must be legal JSON types
# (string, int, float, nil, true, false, hash or array) or
# ActiveModel::GlobalIdentication instances. Arbitrary Ruby objects
@@ -16,7 +16,6 @@ def enqueue(*args)
queue_adapter.queue self, *serialized_args
end
- #
# Enqueue a job to be performed at +interval+ from now.
#
# enqueue_in(1.week, "mike")
@@ -26,16 +25,15 @@ def enqueue_in(interval, *args)
enqueue_at(interval.from_now, *args)
end
- #
# Enqueue a job to be performed at an explicit point in time.
#
# enqueue_at(Date.tomorrow.midnight, "mike")
#
# Returns truthy if a job was scheduled.
def enqueue_at(timestamp, *args)
- ts = timestamp.to_f
- ActiveSupport::Notifications.instrument "enqueue_at.active_job", adapter: queue_adapter, timestamp: ts, job: self, args: args
- queue_adapter.queue_at self, ts, *Parameters.serialize(args)
+ timestamp = timestamp.to_f
+ ActiveSupport::Notifications.instrument "enqueue_at.active_job", adapter: queue_adapter, timestamp: timestamp, job: self, args: args
+ queue_adapter.queue_at self, timestamp, *Parameters.serialize(args)
end
end
end
3  lib/active_job/queue_adapters/inline_adapter.rb
View
@@ -7,14 +7,13 @@ def queue(job, *args)
end
def queue_at(job, ts, *args)
- # TODO better error handling?
Thread.new do
begin
interval = Time.now.to_f - ts
sleep(interval) if interval > 0
job.new.perform *Parameters.deserialize(args)
rescue => ex
- ActiveJob::Base.logger "Error performing #{job}: #{ex.message}"
+ ActiveJob::Base.logger.info "Error performing #{job}: #{ex.message}"
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.