Class: Jiggler::AtMostOnce::Fetcher
- Inherits:
-
BaseFetcher
- Object
- BaseFetcher
- Jiggler::AtMostOnce::Fetcher
- Defined in:
- lib/jiggler/at_most_once/fetcher.rb
Defined Under Namespace
Classes: CurrentJob
Constant Summary collapse
- TIMEOUT =
2 seconds of waiting for brpop
2.0
Instance Attribute Summary
Attributes inherited from BaseFetcher
Instance Method Summary collapse
Methods inherited from BaseFetcher
Methods included from Support::Helper
#log_error, #log_error_short, #logger, #safe_async, #scan_all, #tid
Constructor Details
This class inherits a constructor from Jiggler::BaseFetcher
Instance Method Details
#fetch ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jiggler/at_most_once/fetcher.rb', line 14 def fetch return :done if @done q, args = config.with_sync_redis do |conn| conn.blocking_call(false, 'BRPOP', *config.sorted_lists, TIMEOUT) end if @done requeue(q, args) unless q.nil? return :done end job(q, args) unless q.nil? end |
#start ⇒ Object
10 11 12 |
# File 'lib/jiggler/at_most_once/fetcher.rb', line 10 def start # noop, we just block directly during the fetch end |
#suspend ⇒ Object
29 30 31 |
# File 'lib/jiggler/at_most_once/fetcher.rb', line 29 def suspend @done = true end |