-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] [core-http/search-sdk] How can I specify max sockets or provide my own HTTP agent to an Azure SearchClient? #25522
Comments
In case it's useful, I drafted a PR of what adding max sockets support would look like: #25523 . |
Oh I see the issue here, the problem is that the GA version of @dgetu is there a plan to release a new beta or GA of search anytime soon? It looks like the last beta pre-dates the most recent GA and I'm not sure what will be lost if we suggest @mdmower switch over to it? @mdmower if you wanted to at least test out the new pipeline functionality you could try pulling down the latest |
@xirzec The most recent beta release is at feature parity with GA. The more recent 11.3.1 GA release was a hotfix for a bug that isn't present in the beta. @mdmower I would give the latest beta a try, |
Thanks @dgetu. I took a peek at the beta and the capabilities of |
@mdmower You can modify in-flight import { PipelinePolicy } from "@azure/core-rest-pipeline";
import { SearchClient } from "@azure/search-documents";
import https from "https";
const agentPolicy: PipelinePolicy = {
name: "agentPolicy",
async sendRequest(request, next) {
request.agent = new https.Agent({
/**/
});
return next(request);
},
};
const client = new SearchClient("endpoint", "indexName", "credential" as any, {
additionalPolicies: [{ policy: agentPolicy, position: "perCall" }],
}); This will insert a |
As of 11.3.2, you should be able to use the same technique with the stable version of @azure/search-documents. |
Is there a way to pass in our own http.Agent or to specify maxSockets when creating an Azure SearchClient? I'm aiming to allow the use of both node-fetch and Azure Search SDK in an Azure Function to make requests to
<mysearch>.search.windows.net
, but need to ensure I don't run into port exhaustion (max 128 connections per host/port combination).I started this question here and @xirzec kindly offered some tips, but I haven't managed to piece it all together yet. The suggestion there was:
I haven't seen where I can pass the
additionalPolicies
option for the search client.The constructor for SearchClient allows passing
SearchClientOptions
(which is a small extension of PipelineOptions). Of these options, I take advantage ofkeepAliveOptions
, but I haven't figured out how to provide a customizedHttpClient
. I can construct an instance of NodeFetchHttpClient, but it doesn't appear configurable. Any hints would be appreciated.The text was updated successfully, but these errors were encountered: