Skip to content

Commit 4bdfba6

Browse files
feat(clients): expose waitForTasks to batch helpers [skip-bc] (generated)
algolia/api-clients-automation#4030 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 9201867 commit 4bdfba6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/algolia/api/search_client.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,16 +3333,17 @@ def get_secured_api_key_remaining_validity(secured_api_key)
33333333
#
33343334
# @param index_name [String]: The `index_name` to save `objects` in.
33353335
# @param objects [Array]: The array of `objects` to store in the given Algolia `indexName`.
3336+
# @param wait_for_tasks [Boolean]: Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
33363337
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
33373338
#
33383339
# @return [BatchResponse]
33393340
#
3340-
def save_objects(index_name, objects, request_options = {})
3341+
def save_objects(index_name, objects, wait_for_tasks = false, request_options = {})
33413342
chunked_batch(
33423343
index_name,
33433344
objects,
33443345
Search::Action::ADD_OBJECT,
3345-
false,
3346+
wait_for_tasks,
33463347
1000,
33473348
request_options
33483349
)
@@ -3352,16 +3353,17 @@ def save_objects(index_name, objects, request_options = {})
33523353
#
33533354
# @param index_name [String]: The `index_name` to delete `object_ids` from.
33543355
# @param object_ids [Array]: The object_ids to delete.
3356+
# @param wait_for_tasks [Boolean]: Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
33553357
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
33563358
#
33573359
# @return [BatchResponse]
33583360
#
3359-
def delete_objects(index_name, object_ids, request_options = {})
3361+
def delete_objects(index_name, object_ids, wait_for_tasks = false, request_options = {})
33603362
chunked_batch(
33613363
index_name,
33623364
object_ids.map { |id| {"objectID" => id} },
33633365
Search::Action::DELETE_OBJECT,
3364-
false,
3366+
wait_for_tasks,
33653367
1000,
33663368
request_options
33673369
)
@@ -3372,16 +3374,17 @@ def delete_objects(index_name, object_ids, request_options = {})
33723374
# @param index_name [String]: The `index_name` to delete `object_ids` from.
33733375
# @param objects [Array]: The objects to partially update.
33743376
# @param create_if_not_exists [Boolean]: To be provided if non-existing objects are passed, otherwise, the call will fail.
3377+
# @param wait_for_tasks [Boolean] Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
33753378
# @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
33763379
#
33773380
# @return [BatchResponse]
33783381
#
3379-
def partial_update_objects(index_name, objects, create_if_not_exists, request_options = {})
3382+
def partial_update_objects(index_name, objects, create_if_not_exists, wait_for_tasks = false, request_options = {})
33803383
chunked_batch(
33813384
index_name,
33823385
objects,
33833386
create_if_not_exists ? Search::Action::PARTIAL_UPDATE_OBJECT : Search::Action::PARTIAL_UPDATE_OBJECT_NO_CREATE,
3384-
false,
3387+
wait_for_tasks,
33853388
1000,
33863389
request_options
33873390
)

0 commit comments

Comments
 (0)