chore: Improve the reauthorization requirement for Email Channel (#4753)

This commit is contained in:
Sojan Jose
2022-05-26 20:23:00 +05:30
committed by GitHub
parent 47a6d9681a
commit ab05dd9b9b
5 changed files with 45 additions and 2 deletions

View File

@@ -29,7 +29,9 @@ module Reauthorizable
# Implement in your exception handling logic for authorization errors
def authorization_error!
::Redis::Alfred.incr(authorization_error_count_key)
prompt_reauthorization! if authorization_error_count >= AUTHORIZATION_ERROR_THRESHOLD
# we are giving precendence to the authorization error threshhold defined in the class
# so that channels can override the default value
prompt_reauthorization! if authorization_error_count >= self.class::AUTHORIZATION_ERROR_THRESHOLD
end
# Performed automatically if error threshold is breached