Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 1420e7b

Browse files
authored
Merge pull request #54 from topcoder-platform/read-only-cache-issue
Read only cache issue
2 parents 5d3ce3c + 60ceea9 commit 1420e7b

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

config/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = {
1818
CREATE_DATA_TOPIC: process.env.CREATE_DATA_TOPIC || 'submission.notification.create',
1919
UPDATE_DATA_TOPIC: process.env.UPDATE_DATA_TOPIC || 'submission.notification.update',
2020
DELETE_DATA_TOPIC: process.env.DELETE_DATA_TOPIC || 'submission.notification.delete',
21+
AGGREGATE_DATA_TOPIC: process.env.AGGREGATE_DATA_TOPIC || 'submission.notification.aggregate',
2122

2223
LEADERBOARD_API_URL: process.env.LEADERBOARD_API_URL || 'https://api.topcoder-dev.com/v5/leaderboards',
2324
SUBMISSION_API_URL: process.env.SUBMISSION_API_URL || 'https://api.topcoder-dev.com/v5/submissions',

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ WORKDIR /leaderboard-processor
88

99
# Install the dependencies from package.json
1010
RUN npm install
11-
CMD npm start
11+
CMD node src/app.js

src/app.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const dataHandler = (messageSet, topic, partition) => Promise.each(messageSet, a
4242
}
4343

4444
if (messageJSON.payload.resource !== 'review' && messageJSON.payload.resource !== 'reviewSummation') {
45-
logger.debug(`Ignoring Non review payloads from topic ${messageJSON.topic}.`)
45+
logger.debug(`Ignoring Non review or review summation payloads from topic ${messageJSON.topic}.`)
4646
// ignore the message
4747
return
4848
}
@@ -56,8 +56,10 @@ const dataHandler = (messageSet, topic, partition) => Promise.each(messageSet, a
5656
}
5757
}
5858

59+
const originalTopic = messageJSON.payload.originalTopic
60+
5961
return (async () => {
60-
switch (topic) {
62+
switch (originalTopic) {
6163
case config.CREATE_DATA_TOPIC:
6264
await ProcessorService.upsert(messageJSON)
6365
break
@@ -90,7 +92,7 @@ function check () {
9092
return connected
9193
}
9294

93-
const topics = [config.CREATE_DATA_TOPIC, config.UPDATE_DATA_TOPIC, config.DELETE_DATA_TOPIC]
95+
const topics = [config.AGGREGATE_DATA_TOPIC]
9496

9597
consumer
9698
.init([{

0 commit comments

Comments
 (0)