Skip to content

Commit 7aec748

Browse files
author
Sachin Maheshwari
committed
Temporary disabling the pausing feature as there is chance of losing message during unsubscribe/posing due to using simple Kafka consumer. Also adding linting support.
1 parent 618cdd4 commit 7aec748

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"parserOptions": {
2+
"ecmaVersion": 6
3+
}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ WORKDIR /opt/app
99
COPY . .
1010
RUN npm install
1111
RUN npm install dotenv --save
12-
#RUN npm test
12+
RUN npm run lint
1313
CMD ["npm", "start"]

config/default.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ module.exports = {
3333
TEMPLATE_MAP: process.env.TEMPLATE_MAP,
3434
SENDGRID_API_KEY: process.env.SENDGRID_API_KEY || '',
3535
EMAIL_FROM: process.env.EMAIL_FROM || 'no-reply@topcoder.com',
36+
37+
// temporary not in use feature
3638
EMAIL_MAX_ERRORS: process.env.EMAIL_MAX_ERRORS || 2,
3739
EMAIL_PAUSE_TIME: process.env.EMAIL_PAUSE_TIME || 30,
40+
3841
//in every 2 minutes will retry for failed status
3942
EMAIL_RETRY_SCHEDULE: process.env.EMAIL_RETRY_SCHEDULE || '0 */2 * * * *',
4043
};

src/app.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ function configureKafkaConsumer(handlers) {
7676
emailModel.status = 'SUCCESS';
7777
return emailModel.save();
7878
} else {
79-
emailTries[topicName] += 1;
79+
// emailTries[topicName] += 1; //temporary disabling this feature
8080
emailModel.status = 'FAILED';
8181
return emailModel.save().then(() => {
82+
/*
83+
* temporary disabling this feature as there is chance of losing message during
84+
* unsubscribe/pausing due to simple kafka consumer
85+
*/
86+
/*
8287
const currentTries = emailTries[topicName];
8388
if (currentTries > maxErrors) {
8489
logger.debug(`Failed to send email. Will sleep for ${pauseTime}s`);
@@ -94,7 +99,7 @@ function configureKafkaConsumer(handlers) {
9499
} else {
95100
logger.debug(`Failed to send email (retries left ${maxErrors - currentTries})`);
96101
throw result.error;
97-
}
102+
}*/
98103
});
99104
}
100105
}).then(() => consumer.commitOffset({ topic, partition, offset: m.offset })) // commit offset

0 commit comments

Comments
 (0)