Skip to content

Commit

Permalink
only rescue from the call
Browse files Browse the repository at this point in the history
  • Loading branch information
jmanian committed Sep 18, 2017
1 parent b75bfcb commit 8542d00
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/slack/web/pagination/cursor.rb
Expand Up @@ -21,13 +21,14 @@ def each
query = { limit: client.default_page_size }.merge(params).merge(cursor: next_cursor)
begin
response = client.send(verb, query)
yield response
break unless response.response_metadata
next_cursor = response.response_metadata.next_cursor
break if next_cursor.blank?
rescue Slack::Web::Api::Errors::TooManyRequestsError => e
sleep(e.retry_after.seconds)
next
end
yield response
break unless response.response_metadata
next_cursor = response.response_metadata.next_cursor
break if next_cursor.blank?
end
end
end
Expand Down

0 comments on commit 8542d00

Please sign in to comment.