Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def __init__(self) -> None:

"""
self.max_requests_per_batch = BatchRequestContent.MAX_REQUESTS
self.batches: list[BatchRequestContent] = []
self.current_batch: BatchRequestContent = BatchRequestContent()
self.batches: list[BatchRequestContent] = [self.current_batch]

def add_batch_request_item(self, request: BatchRequestItem) -> None:
"""
Expand All @@ -26,10 +26,10 @@ def add_batch_request_item(self, request: BatchRequestItem) -> None:
request (BatchRequestItem): The request item to add.
"""
if len(self.current_batch.requests) >= self.max_requests_per_batch:
self.batches.append(self.current_batch.finalize())
self.current_batch.finalize()
self.current_batch = BatchRequestContent()
self.batches.append(self.current_batch)
self.current_batch.add_request(request.id, request)
self.batches.append(self.current_batch)

def remove_batch_request_item(self, request_id: str) -> None:
"""
Expand Down