Skip to content

Commit

Permalink
Swallow version conflict errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasolson committed Jul 14, 2020
1 parent 642614a commit 9381b35
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/plugins/data/server/search/collectors/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ export function usageProvider(core: CoreSetup<object, DataPluginStart>): SearchU

const newAttributes = { ...attributes, averageDuration };

if (doesSavedObjectExist) {
await repository.update(SAVED_OBJECT_ID, SAVED_OBJECT_ID, newAttributes);
} else {
await repository.create(SAVED_OBJECT_ID, newAttributes, { id: SAVED_OBJECT_ID });
try {
if (doesSavedObjectExist) {
await repository.update(SAVED_OBJECT_ID, SAVED_OBJECT_ID, newAttributes);
} else {
await repository.create(SAVED_OBJECT_ID, newAttributes, { id: SAVED_OBJECT_ID });
}
} catch (e) {
// Version conflict error, swallow
}
};
};
Expand Down

0 comments on commit 9381b35

Please sign in to comment.