lib/zhong/scheduler.rb in zhong-0.1.3 vs lib/zhong/scheduler.rb in zhong-0.1.4
- old
+ new
@@ -17,19 +17,20 @@
@logger = @config[:logger] ||= Util.default_logger
@redis = @config[:redis] ||= Redis.new(ENV["REDIS_URL"])
end
def category(name)
- fail "cannot nest categories: #{name} would be nested in #{@category}" if @category
+ fail "cannot nest categories: #{name} would be nested in #{@category} (#{caller.first})" if @category
@category = name.to_s
yield(self)
@category = nil
end
def every(period, name, opts = {}, &block)
+ fail "must specify a period for #{name} (#{caller.first})" unless period
job = Job.new(name, opts.merge(@config).merge(every: period, category: @category), &block)
add(job)
end
def error_handler(&block)