Maintenance: Improve handling of Zendesk API hickups/temporary errors.

This commit is contained in:
Denny Bresch 2019-08-09 11:08:43 +02:00 committed by Thorsten Eckel
parent f1eee78381
commit fb027c514b

View file

@ -41,10 +41,13 @@ class Sequencer
def resource_iteration(&block)
resource_collection.public_send(resource_iteration_method, &block)
rescue ZendeskAPI::Error::NetworkError => e
case e.response.status.to_s
when '403'
return if resource_klass.in?(%w[UserField OrganizationField])
when /^5\d\d$/
status = e.response.status.to_s
if status.match?(/^(4|5)\d\d$/)
# #2262 Zendesk-Import fails for User & Organizations when 403 "access" denied
return if status == '403' && resource_klass.in?(%w[UserField OrganizationField])
raise if (fail_count ||= 1) > 10
logger.error e