lib/cloudtasker/worker.rb in cloudtasker-0.12.2 vs lib/cloudtasker/worker.rb in cloudtasker-0.13.rc1
- old
+ new
@@ -45,11 +45,11 @@
# Check that worker class is a valid worker
worker_klass = Object.const_get(klass_name)
return nil unless worker_klass.include?(self)
# Return instantiated worker
- worker_klass.new(payload.slice(:job_queue, :job_args, :job_id, :job_meta, :job_retries, :task_id))
+ worker_klass.new(**payload.slice(:job_queue, :job_args, :job_id, :job_meta, :job_retries, :task_id))
rescue NameError
nil
end
# Module class methods
@@ -119,11 +119,11 @@
# @param [String, Symbol] queue The queue on which the worker should run.
#
# @return [Cloudtasker::CloudTask] The Google Task response
#
def schedule(args: nil, time_in: nil, time_at: nil, queue: nil)
- new(job_args: args, job_queue: queue).schedule({ interval: time_in, time_at: time_at }.compact)
+ new(job_args: args, job_queue: queue).schedule(**{ interval: time_in, time_at: time_at }.compact)
end
#
# Return the numbeer of times this worker will be retried.
#
@@ -237,10 +237,10 @@
#
# @return [Cloudtasker::CloudTask] The Google Task response
#
def schedule(**args)
# Evaluate when to schedule the job
- time_at = schedule_time(args)
+ time_at = schedule_time(**args)
# Schedule job through client middlewares
Cloudtasker.config.client_middleware.invoke(self, time_at: time_at) do
WorkerHandler.new(self).schedule(time_at: time_at)
end