Skip to content

Commit

Permalink
fix: handle concurrent service account updates (#5349) (#5350)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Nov 16, 2023
1 parent 4ca8456 commit 510fa30
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lib/db/access-store.ts
Expand Up @@ -468,11 +468,14 @@ export class AccessStore implements IAccessStore {
roleId: number,
projectId?: string,
): Promise<void> {
return this.db(T.ROLE_USER).insert({
user_id: userId,
role_id: roleId,
project: projectId,
});
await this.db(T.ROLE_USER)
.insert({
user_id: userId,
role_id: roleId,
project: projectId,
})
.onConflict(['user_id', 'role_id', 'project'])
.ignore();
}

async removeUserFromRole(
Expand Down

0 comments on commit 510fa30

Please sign in to comment.