Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasolson committed Feb 18, 2021
1 parent ecdd770 commit 1487a91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/plugins/data/server/search/collectors/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { once } from 'lodash';
import type { CoreSetup, Logger } from 'kibana/server';
import { SavedObjectsErrorHelpers } from 'kibana/server';
import type { IEsSearchResponse } from '../../../common';

const SAVED_OBJECT_ID = 'search-telemetry';
Expand Down Expand Up @@ -35,7 +36,7 @@ export function usageProvider(core: CoreSetup): SearchUsage {
},
]);
} catch (e) {
if (e.statusCode === 409 && retryCount < MAX_RETRY_COUNT) {
if (SavedObjectsErrorHelpers.isConflictError(e) && retryCount < MAX_RETRY_COUNT) {
setTimeout(() => trackSuccess(duration, retryCount + 1), 1000);
}
}
Expand All @@ -48,7 +49,7 @@ export function usageProvider(core: CoreSetup): SearchUsage {
{ fieldName: 'errorCount' },
]);
} catch (e) {
if (e.statusCode === 409 && retryCount < MAX_RETRY_COUNT) {
if (SavedObjectsErrorHelpers.isConflictError(e) && retryCount < MAX_RETRY_COUNT) {
setTimeout(() => trackError(retryCount + 1), 1000);
}
}
Expand Down

0 comments on commit 1487a91

Please sign in to comment.