1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00

task: make setting service handle conflict on insert

Currently, in enterprise we're struggling with setting service and
transactionality; all our verfications says that the setting key is not
present, so setting-store happily tries to insert a new row with a new
PK. However, somehow at the same time, the key already exists. This
commit adds conflict handling to the insertNewRow.
This commit is contained in:
Christopher Kolstad 2025-01-28 11:13:24 +01:00
parent 4d582aac5a
commit cb6af7b902
No known key found for this signature in database
GPG Key ID: D9041DC670F032F3
4 changed files with 292 additions and 289 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.5.3.cjs
yarnPath: .yarn/releases/yarn-4.6.0.cjs

View File

@ -251,5 +251,5 @@
"yarn biome format --write --no-errors-on-unmatched"
]
},
"packageManager": "yarn@4.5.3"
"packageManager": "yarn@4.6.0"
}

View File

@ -33,7 +33,10 @@ export default class SettingStore implements ISettingStore {
}
async insertNewRow(name: string, content: any) {
return this.db(TABLE).insert({ name, content });
return this.db(TABLE)
.insert({ name, content })
.onConflict('name')
.merge();
}
async exists(name: string): Promise<boolean> {