Skip to content

Commit 9a0b3a2

Browse files
committed
moving read preference from session to transaction
1 parent 650a680 commit 9a0b3a2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/controller/registry-org.controller/registry-org.controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ async function getOrg (req, res, next) {
134134
*/
135135
async function createOrg (req, res, next) {
136136
try {
137-
const session = await mongoose.startSession({ causalConsistency: false, readPreference: 'primary' })
137+
const session = await mongoose.startSession({ causalConsistency: false })
138138
const repo = req.ctx.repositories.getBaseOrgRepository()
139139
const body = req.ctx.body
140140
const isSecretariat = await repo.isSecretariatByShortName(req.ctx.org, { session })
@@ -146,7 +146,7 @@ async function createOrg (req, res, next) {
146146
}
147147

148148
try {
149-
session.startTransaction()
149+
session.startTransaction({ readPreference: 'primary' })
150150
const result = repo.validateOrg(body, { session })
151151
if (!result.isValid) {
152152
logger.error(JSON.stringify({ uuid: req.ctx.uuid, message: 'CVE JSON schema validation FAILED.' }))

0 commit comments

Comments
 (0)