Skip to content

Commit

Permalink
fix: depends_on and batch request with content collection
Browse files Browse the repository at this point in the history
  • Loading branch information
musale authored Nov 21, 2024
2 parents d4a6e2a + 0289e2f commit 9d4153a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/msgraph_core/requests/batch_request_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,9 @@ async def _post_batch_collection(
raise ValueError("batch_request_content_collection cannot be Null.")

batch_responses = BatchResponseContentCollection()

for batch_request_content in batch_request_content_collection.batches:
request_info = await self.to_post_request_information(batch_request_content)
response = await self._request_adapter.send_async(
request_info, BatchResponseContent, error_map or self.error_map
)
batch_requests = batch_request_content_collection.get_batch_requests_for_execution()
for batch_request_content in batch_requests:
response = await self.post(batch_request_content, error_map)
batch_responses.add_response(response)

return batch_responses
Expand Down
2 changes: 1 addition & 1 deletion src/msgraph_core/requests/batch_request_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def add_request(self, request_id: Optional[str], request: BatchRequestItem) -> N
request.id = str(uuid.uuid4())
if hasattr(request, 'depends_on') and request.depends_on:
for dependent_id in request.depends_on:
if dependent_id not in [req.id for req in self.requests]:
if dependent_id not in self.requests:
dependent_request = self._request_by_id(dependent_id)
if dependent_request:
self._requests[dependent_id] = dependent_request
Expand Down

0 comments on commit 9d4153a

Please sign in to comment.