Skip to content

Commit 8fa42c2

Browse files
authored
Merge pull request #33 from WorldBank-Transport/feature/fatal-error
Catch db error
2 parents 9b2d931 + 6641f69 commit 8fa42c2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ram-analysis/app/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ operationExecutor
173173
.then(() => process.exit(0))
174174
.catch(err => {
175175
console.log('err', err);
176-
let eGroup = logger.group('error');
176+
let eGroup = logger.group('fatal-error');
177177
if (err.message) {
178178
eGroup.log(err.message);
179179
eGroup.log(err.stack);
@@ -183,7 +183,10 @@ operationExecutor
183183
logger.toFile(`${WORK_DIR}/process.log`);
184184
operation.log(opCodes.OP_ERROR, {error: err.message || err})
185185
.then(() => operation.finish())
186-
.then(() => process.exit(1), () => process.exit(1));
186+
.then(() => process.exit(1))
187+
// If it errors again exit.
188+
// This is especially important in the case of DB errors.
189+
.catch(() => process.exit(1));
187190
});
188191

189192
//

ram-analysis/app/s3/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ switch (STORAGE_ENGINE) {
2424
break;
2525
case 's3':
2626
minioClient = new Minio.Client({
27+
// Endpoint gets updated based on region.
2728
endPoint: 's3.amazonaws.com',
29+
region: STORAGE_REGION,
2830
accessKey: STORAGE_ACCESS_KEY,
2931
secretKey: STORAGE_SECRET_KEY
3032
});

0 commit comments

Comments
 (0)