Skip to content

Commit

Permalink
changing defaults (#164957)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar authored Sep 4, 2023
1 parent 7c54eb2 commit 9d74315
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/plugins/data/common/search/poll_search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('pollSearch', () => {
abortSignal: abortController.signal,
}).toPromise();

await new Promise((resolve) => setTimeout(resolve, 500));
await new Promise((resolve) => setTimeout(resolve, 300));
abortController.abort();

await expect(poll).rejects.toThrow(AbortError);
Expand All @@ -99,7 +99,7 @@ describe('pollSearch', () => {
const cancelFn = jest.fn();
const subscription = pollSearch(searchFn, cancelFn).subscribe(() => {});

await new Promise((resolve) => setTimeout(resolve, 500));
await new Promise((resolve) => setTimeout(resolve, 300));
subscription.unsubscribe();
await new Promise((resolve) => setTimeout(resolve, 1000));

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/data/common/search/poll_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const pollSearch = <Response extends IKibanaSearchResponse>(
else {
// if static pollInterval is not provided, then use default back-off logic
switch (true) {
case elapsedTime < 1500:
return 300;
case elapsedTime < 5000:
return 1000;
case elapsedTime < 20000:
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const searchConfigSchema = schema.object({
* Block and wait until the search is completed up to the timeout (see es async_search's `wait_for_completion_timeout`)
* TODO: we should optimize this as 100ms is likely not optimal (https://github.com/elastic/kibana/issues/143277)
*/
waitForCompletion: schema.duration({ defaultValue: '100ms' }),
waitForCompletion: schema.duration({ defaultValue: '200ms' }),
/**
* How long the async search needs to be available after each search poll. Ongoing async searches and any saved search results are deleted after this period.
* (see es async_search's `keep_alive`)
Expand All @@ -71,7 +71,7 @@ export const searchConfigSchema = schema.object({
* How long to wait before polling the async_search after the previous poll response.
* If not provided, then default dynamic interval with backoff is used.
*/
pollInterval: schema.maybe(schema.number({ min: 1000 })),
pollInterval: schema.maybe(schema.number({ min: 200 })),
}),
aggs: schema.object({
shardDelay: schema.object({
Expand Down

0 comments on commit 9d74315

Please sign in to comment.