Method: WebHooks::AutoDisabling#backoff!
- Defined in:
- app/models/concerns/web_hooks/auto_disabling.rb
#backoff! ⇒ Object
Don’t actually back-off until a grace level of TEMPORARILY_DISABLED_FAILURE_THRESHOLD failures have been seen tracked in the recent_failures counter
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'app/models/concerns/web_hooks/auto_disabling.rb', line 111 def backoff! return unless auto_disabling_enabled? && executable? new_recent_failures = next_failure_count attrs = { recent_failures: new_recent_failures } attrs[:disabled_until] = next_backoff.from_now if new_recent_failures > TEMPORARILY_DISABLED_FAILURE_THRESHOLD assign_attributes(attrs) return unless changed? logger.info(hook_id: id, action: 'backoff', **attrs) save(validate: false) end |