Skip to content

HOTFIX - Performance updates #362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions src/common/informixHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const helper = require('./helper')
const informix = require('informixdb')
const ReviewService = require('../services/ReviewService')
const ReviewSummationService = require('../services/ReviewSummationService')

let dbConnection = null
/*
* This function loads the online review details for a given submission from Informix.
* It uses the data to create review and reviewSummation objects which are then saved
Expand Down Expand Up @@ -90,22 +92,26 @@ async function loadOnlineReviewDetails (authUser, submission) {
}

function queryInformix (query) {
const connectionString = 'SERVER=' + config.get('INFORMIX.SERVER') +
';DATABASE=' + config.get('INFORMIX.DATABASE') +
';HOST=' + config.get('INFORMIX.HOST') +
';Protocol=' + config.get('INFORMIX.PROTOCOL') +
';SERVICE=' + config.get('INFORMIX.PORT') +
';DB_LOCALE=' + config.get('INFORMIX.DB_LOCALE') +
';UID=' + config.get('INFORMIX.USER') +
if (!dbConnection || !dbConnection.connected) {
const connectionString = 'SERVER=' + config.get('INFORMIX.SERVER') +
';DATABASE=' + config.get('INFORMIX.DATABASE') +
';HOST=' + config.get('INFORMIX.HOST') +
';Protocol=' + config.get('INFORMIX.PROTOCOL') +
';SERVICE=' + config.get('INFORMIX.PORT') +
';DB_LOCALE=' + config.get('INFORMIX.DB_LOCALE') +
';UID=' + config.get('INFORMIX.USER') +
';PWD=' + config.get('INFORMIX.PASSWORD')

try {
dbConnection = informix.openSync(connectionString)
} catch (ex) {
logger.error(`Informix connection error: ${ex}`)
}
}
let result = null
try {
const conn = informix.openSync(connectionString)
result = conn.querySync(query)
conn.closeSync()
result = dbConnection.querySync(query)
} catch (ex) {
logger.error(ex)
logger.error(`Informix query error: ${ex}`)
}

return result
Expand Down