Adding a batch request step should not authenticate the request #2774
Labels
status:waiting-for-triage
An issue that is yet to be reviewed or assigned
type:feature
New experience request
Is your feature request related to a problem? Please describe the problem.
Recently I created through the SDK a batch request to receive the members and owners of a bunch of group ids. During testing, I noticed that adding all these requests to the batch takes a relatively long time.
After some digging into the code I found the root source to be the call to
RequestAdapter.ConvertToNativeRequestAsync<HttpRequestMessage>()
which will callAuthenticateRequestAsync()
of the given authentication provider. This is not needed, cause the token on the individual request will be ignored and not being serialized into the batch step information.Describe the solution you'd like.
To solve this issue I created an intermediate service client with my own do nothing authentication provider, used that to create the native request and added it via
AddBatchRequestStep()
. After doing so, the loop with 200 requests dropped from 300ms down to 1ms:Additional context?
To make it easier to reproduce the problem, here is some sample code that shows how
AddBatchRequestStepAsync()
internally calls the authentication validator:The text was updated successfully, but these errors were encountered: