Skip to content

Commit 1d147d5

Browse files
committed
Fixing AWS specific issues
1 parent a8164a9 commit 1d147d5

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/controller/registry-user.controller/registry-user.controller.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async function updateUser (req, res, next) {
213213
214214
We need to make sure that either way we convert to one or the other. For now, I am going shortname / username
215215
*/
216-
const session = await mongoose.startSession()
216+
const session = await mongoose.startSession({ causalConsistency: false })
217217
// Check to see if identifier is set
218218
const identifier = req.ctx.params.identifier
219219

@@ -315,6 +315,7 @@ async function updateUser (req, res, next) {
315315

316316
let result
317317
let updatedUser
318+
let updatedUserUUID
318319
try {
319320
session.startTransaction()
320321
try {
@@ -349,6 +350,8 @@ async function updateUser (req, res, next) {
349350
}
350351
}
351352

353+
// UUID of the user will not change, lets get it before we write to avoid read after write issues.
354+
updatedUserUUID = await userRepo.getUserUUID(req.ctx.user, org.UUID)
352355
updatedUser = await userRepo.updateUserFull(userToEdit.UUID, body, { session })
353356
await session.commitTransaction()
354357
} catch (error) {
@@ -363,9 +366,9 @@ async function updateUser (req, res, next) {
363366
change: userToEditParameters.username + ' was successfully updated.',
364367
req_UUID: req.ctx.uuid,
365368
org_UUID: org.UUID,
366-
user: updatedUser
369+
user: updatedUser,
370+
user_UUID: updatedUserUUID
367371
}
368-
payload.user_UUID = await userRepo.getUserUUID(req.ctx.user, payload.org_UUID)
369372
logger.info(JSON.stringify(payload))
370373

371374
return res.status(200).json(

0 commit comments

Comments
 (0)