* 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> Co-authored-by: Brandon Kobel <brandon.kobel@elastic.co>
This commit is contained in:
parent
a3e390f924
commit
b05ee6ddca
|
@ -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…
Reference in a new issue