From 69ab898bf36ff846058e5982433dfdcca025616d Mon Sep 17 00:00:00 2001 From: Mohamad Ihsan Date: Thu, 28 Sep 2023 13:08:51 +0700 Subject: [PATCH 1/3] update bugs --- application/modules/loadbalance/loadbalance.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/modules/loadbalance/loadbalance.controller.js b/application/modules/loadbalance/loadbalance.controller.js index 9aa7016..d38632c 100644 --- a/application/modules/loadbalance/loadbalance.controller.js +++ b/application/modules/loadbalance/loadbalance.controller.js @@ -1485,7 +1485,7 @@ const loadingBalanceInsert = async (req, param) => { code: '500', message: process.env.NODE_ENV != 'production' - ? error.message + ? '500 internal server error (max loop) - backend server.' : '500 internal server error (max loop) - backend server.', data: {}, }; From 19de1236289bbeaa75411fa2ac6a16816bd43850 Mon Sep 17 00:00:00 2001 From: Mohamad Ihsan Date: Mon, 2 Oct 2023 10:44:19 +0700 Subject: [PATCH 2/3] update bugs redis set sequence --- .../loadbalance/loadbalance.controller.js | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/application/modules/loadbalance/loadbalance.controller.js b/application/modules/loadbalance/loadbalance.controller.js index d38632c..398e836 100644 --- a/application/modules/loadbalance/loadbalance.controller.js +++ b/application/modules/loadbalance/loadbalance.controller.js @@ -249,6 +249,12 @@ const updateAllTransaction = async ( loadBalanceNoSequence++; } + // set sequence to redis + await setLoadBalanceNumberSequence( + req.partner_id_token, + loadBalanceNoSequence + ); + // log warn winston.logger.warn(`${uniqueCode} generating load balance number...`); @@ -260,10 +266,10 @@ const updateAllTransaction = async ( if (newLoadBalanceNumber != 'XX') { // set sequence to redis - await setLoadBalanceNumberSequence( - req.partner_id_token, - loadBalanceNoSequence - ); + // await setLoadBalanceNumberSequence( + // req.partner_id_token, + // loadBalanceNoSequence + // ); } // log warn @@ -274,7 +280,7 @@ const updateAllTransaction = async ( if (maxLoop > maxLoopParameter) { // create log winston.logger.error( - `500 internal server error. Server is busy. please try again` + `${uniqueCode} 500 internal server error. Server is busy. please try again` ); return false; @@ -1451,6 +1457,12 @@ const loadingBalanceInsert = async (req, param) => { loadBalanceNoSequence++; } + // set sequence to redis + await setLoadBalanceNumberSequence( + req.partner_id_token, + loadBalanceNoSequence + ); + // log warn // winston.logger.warn( // `${uniqueCode} [ PROCESSING LOADING-BALANCE-INSERT ]: generating load balance number...` @@ -1464,10 +1476,10 @@ const loadingBalanceInsert = async (req, param) => { if (loadBalanceNumber != 'XX') { // set sequence to redis - await setLoadBalanceNumberSequence( - req.partner_id_token, - loadBalanceNoSequence - ); + // await setLoadBalanceNumberSequence( + // req.partner_id_token, + // loadBalanceNoSequence + // ); } // log warn @@ -1478,7 +1490,7 @@ const loadingBalanceInsert = async (req, param) => { if (maxLoop > maxLoopParameter) { // create log winston.logger.error( - `[ RESPONSE LOADING-BALANCE-INSERT ]: 500 internal server error. Server is busy. please try again` + `${uniqueCode} [ RESPONSE LOADING-BALANCE-INSERT ]: 500 internal server error. Server is busy. please try again` ); return { From a2079a726316aa62e13faa4fc99fe14037cca3d8 Mon Sep 17 00:00:00 2001 From: Mohamad Ihsan Date: Mon, 2 Oct 2023 13:36:24 +0700 Subject: [PATCH 3/3] update log --- .../loadbalance/loadbalance.controller.js | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/application/modules/loadbalance/loadbalance.controller.js b/application/modules/loadbalance/loadbalance.controller.js index 398e836..5b6be55 100644 --- a/application/modules/loadbalance/loadbalance.controller.js +++ b/application/modules/loadbalance/loadbalance.controller.js @@ -331,26 +331,26 @@ const updateAllTransaction = async ( await model.createDetailLoadBalanceFromReservation(reservationNumber); // log debug - winston.logger.debug( - `${uniqueCode} detail load balance with reservation no : ${JSON.stringify( - reservationNumber - )}` - ); + // winston.logger.debug( + // `${uniqueCode} detail load balance with reservation no : ${JSON.stringify( + // reservationNumber + // )}` + // ); if (detailLoadBalance.length > 0) { // log warn - winston.logger.warn( - `${uniqueCode} AAAAAAAAAAAAAAAAAA1111 [DATA] : ${JSON.stringify( - reservationNumber - )} [LB] : ${JSON.stringify(dataLoadBalance)} [LBD] : ${JSON.stringify( - detailLoadBalance - )} [NOW] : ${JSON.stringify(now)} [FLAG] : ${JSON.stringify(flag)}` - ); + // winston.logger.warn( + // `${uniqueCode} AAAAAAAAAAAAAAAAAA1111 [DATA] : ${JSON.stringify( + // reservationNumber + // )} [LB] : ${JSON.stringify(dataLoadBalance)} [LBD] : ${JSON.stringify( + // detailLoadBalance + // )} [NOW] : ${JSON.stringify(now)} [FLAG] : ${JSON.stringify(flag)}` + // ); // log debug - winston.logger.debug( - `${uniqueCode} updating reservation and insert new load balance transaction...` - ); + // winston.logger.debug( + // `${uniqueCode} updating reservation and insert new load balance transaction...` + // ); // update reservation and load balance transaction let updateReservationAndInsertLoadingBalance = @@ -363,11 +363,11 @@ const updateAllTransaction = async ( ); // log debug - winston.logger.debug( - `${uniqueCode} status insert new load balance and update reservation : ${JSON.stringify( - updateReservationAndInsertLoadingBalance - )}` - ); + // winston.logger.debug( + // `${uniqueCode} status insert new load balance and update reservation : ${JSON.stringify( + // updateReservationAndInsertLoadingBalance + // )}` + // ); // if (updateReservationAndInsertLoadingBalance > 0) { // // log debug @@ -889,7 +889,7 @@ const loadingBalanceRequest = async (req, res) => { if (getBIRegulationStatus.c_value == 'A') { // log debug - winston.logger.debug(`${uniqueCode} checking topup partial status...`); + // winston.logger.debug(`${uniqueCode} checking topup partial status...`); // check topup partial status let getTopupPartialStatus = await model.getTopupPartialStatus(); @@ -1636,19 +1636,19 @@ const loadingBalanceInsert = async (req, param) => { ); // log warn - winston.logger.warn( - `${uniqueCode} [DATA] : ${JSON.stringify( - data - )} [DETAIL] : ${JSON.stringify(detail)} [RSV] : ${JSON.stringify( - reservation_number - )} [NOW] : ${JSON.stringify(now)} [WRITE STATUS] : ${JSON.stringify( - write_status - )} [CARD NUMBER] : ${JSON.stringify( - card_number - )} [UID] : ${JSON.stringify(uid)} [BALANCE] : ${JSON.stringify( - balance - )} [FLAG] : ${JSON.stringify(flag)}` - ); + // winston.logger.warn( + // `${uniqueCode} [DATA] : ${JSON.stringify( + // data + // )} [DETAIL] : ${JSON.stringify(detail)} [RSV] : ${JSON.stringify( + // reservation_number + // )} [NOW] : ${JSON.stringify(now)} [WRITE STATUS] : ${JSON.stringify( + // write_status + // )} [CARD NUMBER] : ${JSON.stringify( + // card_number + // )} [UID] : ${JSON.stringify(uid)} [BALANCE] : ${JSON.stringify( + // balance + // )} [FLAG] : ${JSON.stringify(flag)}` + // ); if (insertLoadingBalance > 0) { result = {