Skip to content

Commit

Permalink
feat: use SERIALIZABLE transaction isolation level
Browse files Browse the repository at this point in the history
  • Loading branch information
ZavenArra committed Feb 20, 2021
1 parent 847db1d commit 91b8f11
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion server/database/knex.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@ let knexConfig = {
client: 'pg',
debug: process.env.NODE_LOG_LEVEL === "debug"? true:false,
connection,
pool: { min:0, max: 100},
pool: {
min:0,
max: 100,
afterCreate: function (conn, done) {
conn.query('SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE;', function (err) {
if (err) {
log.error(err)
done(err, conn)
} else {
log.debug('SERIALIZABLE isolation level set successfully')
done(err, conn)
}
});
}
},
}

log.debug(process.env.DATABASE_SCHEMA)
Expand Down

0 comments on commit 91b8f11

Please sign in to comment.