Guest User

Untitled

a guest
Feb 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. require 'redis_watcher'
  2. require 'resque-loner'
  3. require 'resque-lock-timeout'
  4.  
  5. class PubsubListener < Resque::Plugins::Loner::UniqueJob
  6. extend Resque::Plugins::LockTimeout
  7. @queue = :long_queue
  8. @lock_timeout = 30
  9.  
  10. def self.perform
  11. #heartbeat thread to refresh lock
  12. thread = Thread.new do
  13. while true do
  14. self.refresh_lock
  15. sleep 5
  16. end
  17. end
  18.  
  19. Rails.logger.info "Got here"
  20. RedisClient.subscribe(self)
  21.  
  22.  
  23. end
  24. end
Add Comment
Please, Sign In to add comment