Skip to content

Commit f8cf864

Browse files
committed
DS-2252
DatabaseWriter.js: Add todos and retry all strategies except "ERROR". Signed-off-by: mchrza <maximilian.chrzan@here.com>
1 parent 90ca22c commit f8cf864

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

xyz-util/src/main/resources/sql/DatabaseWriter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ class DatabaseWriter {
100100
}
101101
catch (e) {
102102
if (e.sqlerrcode === SQLErrors.CONFLICT) {
103+
//TODO: Implement a robust solution with recursive retries by using a callbackFunction
103104
let onVersionConflict = options?.onVersionConflict;
104105

105-
if (onVersionConflict == null) {
106+
//TODO: handle different Strategies separately
107+
if (onVersionConflict == null || onVersionConflict !== "ERROR") {
106108
const versionParameterIndex = options?.versionParameterIndex ?? 1;
107109
const originalVersion = parameters[versionParameterIndex];
108110
parameters[versionParameterIndex] = FeatureWriter.getNextVersion(false);
@@ -122,6 +124,7 @@ class DatabaseWriter {
122124

123125
let exceptionToThrow;
124126

127+
//TODO: Distinguish better different Strategies
125128
if (onVersionConflict === "ERROR")
126129
exceptionToThrow = new VersionConflictError(`Version conflict while trying to write feature with ID ${parameters[0]} in version ${parameters[1]}.`);
127130
else

0 commit comments

Comments
 (0)