Class: Emque::Consuming::Control::Errors

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/emque/consuming/control/errors.rb

Constant Summary collapse

COMMANDS =
[:clear, :down, :expire_after, :up, :retry]

Instance Method Summary collapse

Instance Method Details

#clearObject



9
10
11
# File 'lib/emque/consuming/control/errors.rb', line 9

def clear
  app.error_tracker.occurrences.clear
end

#downObject



13
14
15
16
17
18
# File 'lib/emque/consuming/control/errors.rb', line 13

def down
  if app.error_tracker.limit > 1
    config.error_limit = app.error_tracker.limit -= 1
    app.verify_error_status
  end
end

#expire_after(seconds) ⇒ Object



20
21
22
23
24
25
# File 'lib/emque/consuming/control/errors.rb', line 20

def expire_after(seconds)
  unless seconds.is_a?(Integer)
    raise ArgumentError, "first argument must be an integer"
  end
  config.error_expiration = app.error_tracker.expiration = seconds
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/emque/consuming/control/errors.rb', line 35

def respond_to?(method)
  COMMANDS.include?(method.to_sym)
end

#retryObject



31
32
33
# File 'lib/emque/consuming/control/errors.rb', line 31

def retry
  app.manager.retry_errors
end

#upObject



27
28
29
# File 'lib/emque/consuming/control/errors.rb', line 27

def up
  config.error_limit = app.error_tracker.limit += 1
end