This repository was archived by the owner on Jan 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ The following parameters can be set in config files or in env variables:
35
35
- KAFKA_GROUP_ID: the Kafka group id, default value is 'legacy-challenge-processor'
36
36
- KAFKA_ERROR_TOPIC: The kafka error topic.
37
37
- BUSAPI_URL: Bus API URL
38
+ - RETRY_TIMEOUT: The timeout to retry processing the same message
38
39
- CREATE_CHALLENGE_TOPIC: the create challenge Kafka message topic, default value is 'challenge.notification.create'
39
40
- UPDATE_CHALLENGE_TOPIC: the update challenge Kafka message topic, default value is 'challenge.notification.update'
40
41
- AUTH0_URL: Auth0 URL, used to get TC M2M token
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ module.exports = {
15
15
KAFKA_GROUP_ID : process . env . KAFKA_GROUP_ID || 'legacy-challenge-processor' ,
16
16
KAFKA_ERROR_TOPIC : process . env . KAFKA_ERROR_TOPIC || 'common.error.reporting' ,
17
17
BUSAPI_URL : process . env . BUSAPI_URL || 'https://api.topcoder-dev.com/v5' ,
18
+ RETRY_TIMEOUT : process . env . RETRY_TIMEOUT || 10 * 1000 ,
18
19
19
20
// Topics to listen
20
21
CREATE_CHALLENGE_TOPIC : process . env . CREATE_CHALLENGE_TOPIC || 'challenge.notification.create' ,
Original file line number Diff line number Diff line change @@ -293,7 +293,12 @@ async function processUpdate (message) {
293
293
} catch ( e ) {
294
294
// postponne kafka event
295
295
logger . info ( 'Challenge does not exist yet. Will post the same message back to the bus API' )
296
- await helper . postBusEvent ( config . UPDATE_CHALLENGE_TOPIC , message . payload )
296
+ await new Promise ( ( resolve ) => {
297
+ setTimeout ( async ( ) => {
298
+ await helper . postBusEvent ( config . UPDATE_CHALLENGE_TOPIC , message . payload )
299
+ resolve ( )
300
+ } , config . RETRY_TIMEOUT )
301
+ } )
297
302
return
298
303
}
299
304
try {
You can’t perform that action at this time.
0 commit comments