mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Reverting to legacy ES client behavior where maxSockets = Infinity (#113644)
* Reverting to legacy ES client behavior where maxSockets = Infinity * Removing unnused type * Specifying keepAlive: true by default Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
94b2e30bd7
commit
a4ee087fd7
2 changed files with 32 additions and 10 deletions
|
@ -37,6 +37,19 @@ describe('parseClientOptions', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('specifies `headers.maxSockets` Infinity and `keepAlive` true by default', () => {
|
||||
const config = createConfig({});
|
||||
|
||||
expect(parseClientOptions(config, false)).toEqual(
|
||||
expect.objectContaining({
|
||||
agent: {
|
||||
keepAlive: true,
|
||||
maxSockets: Infinity,
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
describe('basic options', () => {
|
||||
it('`customHeaders` option', () => {
|
||||
const config = createConfig({
|
||||
|
@ -76,11 +89,21 @@ describe('parseClientOptions', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('`keepAlive` option', () => {
|
||||
expect(parseClientOptions(createConfig({ keepAlive: true }), false)).toEqual(
|
||||
expect.objectContaining({ agent: { keepAlive: true } })
|
||||
);
|
||||
expect(parseClientOptions(createConfig({ keepAlive: false }), false).agent).toBeUndefined();
|
||||
describe('`keepAlive option`', () => {
|
||||
it('`keepAlive` is true', () => {
|
||||
const options = parseClientOptions(createConfig({ keepAlive: true }), false);
|
||||
expect(options.agent).toHaveProperty('keepAlive', true);
|
||||
});
|
||||
|
||||
it('`keepAlive` is false', () => {
|
||||
const options = parseClientOptions(createConfig({ keepAlive: false }), false);
|
||||
expect(options.agent).toHaveProperty('keepAlive', false);
|
||||
});
|
||||
|
||||
it('`keepAlive` is undefined', () => {
|
||||
const options = parseClientOptions(createConfig({}), false);
|
||||
expect(options.agent).toHaveProperty('keepAlive', true);
|
||||
});
|
||||
});
|
||||
|
||||
it('`sniffOnStart` options', () => {
|
||||
|
|
|
@ -59,6 +59,10 @@ export function parseClientOptions(
|
|||
// do not make assumption on user-supplied data content
|
||||
// fixes https://github.com/elastic/kibana/issues/101944
|
||||
disablePrototypePoisoningProtection: true,
|
||||
agent: {
|
||||
maxSockets: Infinity,
|
||||
keepAlive: config.keepAlive ?? true,
|
||||
},
|
||||
};
|
||||
|
||||
if (config.pingTimeout != null) {
|
||||
|
@ -73,11 +77,6 @@ export function parseClientOptions(
|
|||
? config.sniffInterval
|
||||
: getDurationAsMs(config.sniffInterval);
|
||||
}
|
||||
if (config.keepAlive) {
|
||||
clientOptions.agent = {
|
||||
keepAlive: config.keepAlive,
|
||||
};
|
||||
}
|
||||
|
||||
if (!scoped) {
|
||||
if (config.username && config.password) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue