Maintenance: Improve handling of Zendesk API hickups/temporary errors.
This commit is contained in:
parent
f1eee78381
commit
fb027c514b
1 changed files with 7 additions and 4 deletions
|
@ -41,10 +41,13 @@ class Sequencer
|
||||||
def resource_iteration(&block)
|
def resource_iteration(&block)
|
||||||
resource_collection.public_send(resource_iteration_method, &block)
|
resource_collection.public_send(resource_iteration_method, &block)
|
||||||
rescue ZendeskAPI::Error::NetworkError => e
|
rescue ZendeskAPI::Error::NetworkError => e
|
||||||
case e.response.status.to_s
|
status = e.response.status.to_s
|
||||||
when '403'
|
|
||||||
return if resource_klass.in?(%w[UserField OrganizationField])
|
if status.match?(/^(4|5)\d\d$/)
|
||||||
when /^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
|
raise if (fail_count ||= 1) > 10
|
||||||
|
|
||||||
logger.error e
|
logger.error e
|
||||||
|
|
Loading…
Reference in a new issue