Skip to content

Commit 55fba15

Browse files
committed
feat(clients): expose waitForTasks to batch helpers
1 parent c16b91d commit 55fba15

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

templates/python/search_helpers.mustache

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,23 +256,25 @@
256256
self,
257257
index_name: str,
258258
objects: List[Dict[str, Any]],
259+
wait_for_tasks: bool = false,
259260
request_options: Optional[Union[dict, RequestOptions]] = None,
260261
) -> List[BatchResponse]:
261262
"""
262263
Helper: Saves the given array of objects in the given index. The `chunked_batch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it.
263264
"""
264-
return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=objects, action=Action.ADDOBJECT, request_options=request_options)
265+
return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=objects, action=Action.ADDOBJECT, wait_for_tasks=wait_for_tasks, request_options=request_options)
265266
266267
{{^isSyncClient}}async {{/isSyncClient}}def delete_objects(
267268
self,
268269
index_name: str,
269270
object_ids: List[str],
271+
wait_for_tasks: bool = false,
270272
request_options: Optional[Union[dict, RequestOptions]] = None,
271273
) -> List[BatchResponse]:
272274
"""
273275
Helper: Deletes every records for the given objectIDs. The `chunked_batch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
274276
"""
275-
return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=[{"objectID": id} for id in object_ids], action=Action.DELETEOBJECT, request_options=request_options)
277+
return {{^isSyncClient}}await {{/isSyncClient}}self.chunked_batch(index_name=index_name, objects=[{"objectID": id} for id in object_ids], action=Action.DELETEOBJECT, wait_for_tasks=wait_for_tasks, request_options=request_options)
276278
277279
{{^isSyncClient}}async {{/isSyncClient}}def partial_update_objects(
278280
self,

0 commit comments

Comments
 (0)