Skip to content

Commit 9381b35

Browse files
committed
Swallow version conflict errors
1 parent 642614a commit 9381b35

File tree

1 file changed

+8
-4
lines changed
  • src/plugins/data/server/search/collectors

1 file changed

+8
-4
lines changed

src/plugins/data/server/search/collectors/usage.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ export function usageProvider(core: CoreSetup<object, DataPluginStart>): SearchU
5858

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

61-
if (doesSavedObjectExist) {
62-
await repository.update(SAVED_OBJECT_ID, SAVED_OBJECT_ID, newAttributes);
63-
} else {
64-
await repository.create(SAVED_OBJECT_ID, newAttributes, { id: SAVED_OBJECT_ID });
61+
try {
62+
if (doesSavedObjectExist) {
63+
await repository.update(SAVED_OBJECT_ID, SAVED_OBJECT_ID, newAttributes);
64+
} else {
65+
await repository.create(SAVED_OBJECT_ID, newAttributes, { id: SAVED_OBJECT_ID });
66+
}
67+
} catch (e) {
68+
// Version conflict error, swallow
6569
}
6670
};
6771
};

0 commit comments

Comments
 (0)