Sha256: 9dbb090803ea9396e8b07d01876d0430f697dfc5aaa9e7c49db4773fd241c9a4
Contents?: true
Size: 771 Bytes
Versions: 1
Compression:
Stored size: 771 Bytes
Contents
require "clockwork_web/version" # dependencies require "clockwork" require "robustly" # engine require "clockwork_web/engine" module ClockworkWeb class << self attr_accessor :redis end def self.enable(job) ClockworkWeb.redis.del("clockwork:disabled:#{job}") true end def self.disable(job) ClockworkWeb.redis.set("clockwork:disabled:#{job}", 1) true end def self.enabled?(job) !ClockworkWeb.redis.exists("clockwork:disabled:#{job}") end end module Clockwork on(:before_run) do |t| run = true safely do if ClockworkWeb.redis run = ClockworkWeb.enabled?(t.job) if run ClockworkWeb.redis.set("clockwork:last_run:#{t.job}", Time.now.to_i) end end end run end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clockwork_web-0.0.1 | lib/clockwork_web.rb |