README.md in zhong-0.1.2 vs README.md in zhong-0.1.3

- old
+ new

@@ -18,15 +18,19 @@ r = Redis.new Zhong.schedule(redis: r) do |s| s.category "stuff" do s.every(5.seconds, "foo") { puts "foo" } + s.every(1.minute, "biz", at: ["**:26", "**:27"]) { puts "biz" } s.every(1.week, "baz", at: ["mon 22:45", "wed 23:13"]) { puts "baz" } + s.every(10.seconds, "boom") { raise "fail" } end s.category "clutter" do - s.every(1.second, "compute", if: -> (t) { t.wday == 3 && rand < 0.5 }) { puts "something happened on wednesday" } + s.every(1.second, "compute", if: -> (t) { t.wday == 3 && rand < 0.5 }) do + puts "something happened on wednesday, maybe" + end end # note: callbacks that return nil or false will cause event to not run s.on(:before_tick) do puts "ding" @@ -35,11 +39,14 @@ s.on(:after_tick) do puts "dong" true end -end + s.error_handler do |e, job| + puts "damn, #{job} messed up: #{e}" + end +end ``` ## TODO - better logging - error handling