lib/qpush/server/jobs.rb in qpush-0.1.4 vs lib/qpush/server/jobs.rb in qpush-0.1.6

- old
+ new

@@ -1,7 +1,17 @@ module QPush module Server + module JobRegister + def included(base) + _register_job(base) + end + + def _register_job(base) + Server.redis { |c| c.sadd(QPush::Base::KEY + ':jobs', base.name) } + end + end + module JobHelpers def mark_success @failed = false @total_success += 1 end @@ -44,14 +54,15 @@ def retry_at Time.now.to_i + ((@total_fail**4) + 15 + (rand(30) * (@total_fail + 1))) end end - class Job < QPush::Job::Base + class Job < QPush::Base::Job extend Forwardable include QPush::Server::JobHelpers include ObjectValidator::Validate + def initialize(options) super @api = ApiWrapper.new(self) end