Skip to content

Commit

Permalink
Merge pull request #1142 from UniversityOfHelsinkiCS/trunk
Browse files Browse the repository at this point in the history
Decrease suicide rate
  • Loading branch information
Rochet2 authored Jul 19, 2019
2 parents 5777497 + 95f0de7 commit 38afeed
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
6 changes: 2 additions & 4 deletions services/backend/oodikone2-backend/src/database/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ const conf = require('../conf-backend')
const sequelize = new Sequelize(conf.DB_URL, {
schema: conf.DB_SCHEMA,
searchPath: conf.DB_SCHEMA,
logging: false,
operatorsAliases: false
logging: false
})
sequelize.query(`SET SESSION search_path to ${conf.DB_SCHEMA}`)

const sequelizeKone = new Sequelize(conf.DB_URL_KONE, {
schema: conf.DB_SCHEMA_KONE,
searchPath: conf.DB_SCHEMA_KONE,
logging: false,
operatorsAliases: false
logging: false
})
sequelizeKone.query(`SET SESSION search_path to ${conf.DB_SCHEMA_KONE}`)

Expand Down
11 changes: 8 additions & 3 deletions services/backend/updater_writer/database/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ const conf = require('../conf-backend')
const sequelize = new Sequelize(conf.DB_URL, {
schema: conf.DB_SCHEMA,
searchPath: conf.DB_SCHEMA,
logging: false,
operatorsAliases: false
retry: {
max: 5,
match: [
Sequelize.TimeoutError
]
},
logging: false
})
sequelize.query(`SET SESSION search_path to ${conf.DB_SCHEMA}`)

Expand Down Expand Up @@ -54,4 +59,4 @@ module.exports = {
sequelize,
migrationPromise,
forceSyncDatabase
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const updateStudent = async (student, stan) => {
if (err.parent.code === '25P02') {
console.log('Transaction aborted')
} else if (err.message === 'deadlock detected') {
console.log(err)
console.log('Deadlock suicide')
stan.close()
process.exit(1)
Expand Down
3 changes: 1 addition & 2 deletions services/oodikone2-analytics/src/database/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ const conf = require('../conf')

const sequelize = new Sequelize(conf.DB_URL, {
schema: conf.DB_SCHEMA,
logging: false,
operatorsAliases: false
logging: false
})
const runMigrations = async () => {
try {
Expand Down
3 changes: 1 addition & 2 deletions services/oodikone2-userservice/src/database/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ const conf = require('../conf')

const sequelize = new Sequelize(conf.DB_URL, {
schema: conf.DB_SCHEMA,
logging: false,
operatorsAliases: false
logging: false
})
const runMigrations = async () => {
try {
Expand Down

0 comments on commit 38afeed

Please sign in to comment.