lib/lazylead/schedule.rb in lazylead-0.3.1 vs lib/lazylead/schedule.rb in lazylead-0.4.0
- old
+ new
@@ -38,11 +38,11 @@
# The minimum time period for cron is 1 minute and it's not suitable for
# unit testing, thus its better to introduce new types which allows to
# schedule some task once or at particular time period like in next 200ms).
# For cron expressions we should define separate test suite which will test
# in parallel without blocking main CI process.
- def initialize(log = Log::NOTHING, cling = true)
+ def initialize(log = Log.new, cling = true)
@log = log
@cling = cling
@trigger = Rufus::Scheduler.new
end
@@ -50,11 +50,11 @@
# application.
def register(task)
raise "ll-002: task can't be a null" if task.nil?
@trigger.cron task.cron do
ActiveRecord::Base.connection_pool.with_connection do
- task.exec @log
+ ORM::VerboseTask.new(task, @log).exec
end
end
@log.debug "Task scheduled: #{task}"
end
@@ -73,10 +73,10 @@
end
end
# Fake application schedule for unit testing purposes
class NoSchedule
- def initialize(log = Log::NOTHING)
+ def initialize(log = Log.new)
@log = log
end
def register(task)
@log.debug("Task registered: #{task}")