Skip to content

Commit

Permalink
fix: API polling flood issue due to msec sleep time mishandling (#472)
Browse files Browse the repository at this point in the history
* fix API polling flood issue due to msec sleep time mishandling

* for Semantic Pull Request check

* fix: API polling flood issue due to msec sleep time mishandling
  • Loading branch information
kiyohara authored Apr 15, 2022
1 parent 052e961 commit 90d8ea5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/algolia/responses/add_api_key_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def wait(opts = {})
end
retries_count += 1
time_before_retry = retries_count * Defaults::WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY
sleep(time_before_retry / 1000)
sleep(time_before_retry.to_f / 1000)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/algolia/responses/delete_api_key_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def wait(opts = {})
unless @done
retries_count += 1
time_before_retry = retries_count * Defaults::WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY
sleep(time_before_retry / 1000)
sleep(time_before_retry.to_f / 1000)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/algolia/responses/restore_api_key_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def wait(opts = {})
end
retries_count += 1
time_before_retry = retries_count * Defaults::WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY
sleep(time_before_retry / 1000)
sleep(time_before_retry.to_f / 1000)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/algolia/responses/update_api_key_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def wait(opts = {})
raise e unless e.code == 404
retries_count += 1
time_before_retry = retries_count * Defaults::WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY
sleep(time_before_retry / 1000)
sleep(time_before_retry.to_f / 1000)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/algolia/search_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def wait_task(task_id, time_before_retry = Defaults::WAIT_TASK_DEFAULT_TIME_BEFO
if status == 'published'
return
end
sleep(time_before_retry / 1000)
sleep(time_before_retry.to_f / 1000)
end
end

Expand Down

0 comments on commit 90d8ea5

Please sign in to comment.