Skip to content

Client allows endless loops if there is a network issue #390

Description

@kaspergrubbe
  • Algolia Client Version: Only tested 1.26.0
  • Language Version: Not relevant.

Description

This is basically an endless loop:

#
# Wait the publication of a task on the server.
# All server task are asynchronous and you can check with this method that the task is published.
#
# @param index_name the index name owning the taskID
# @param taskID the id of the task returned by server
# @param time_before_retry the time in milliseconds before retry (default = 100ms)
# @param request_options contains extra parameters to send with your query
#
def wait_task(index_name, taskID, time_before_retry = WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options = {})
loop do
status = get_task_status(index_name, taskID, request_options)
if status == 'published'
return
end
sleep(time_before_retry.to_f / 1000)
end
end

There should be some retry logic, and if enough fails it should throw an error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions