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

Commit 73259a2

Browse files
committed
Hack in 30 second delay after activation
1 parent 94ac037 commit 73259a2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

services/IssueService.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,11 @@ async function handleIssueClose(event, issue) { // eslint-disable-line
431431

432432
if (closeChallenge) {
433433
logger.debugWithContext(`The associated challenge ${dbIssue.challengeUUID} is being scheduled for cancellation since no payment will be given`,
434-
event, issue);
435-
// Currently, there is no working API for closing challenge.
436-
// The process is just ignored.
434+
event, issue);
435+
await dbHelper.update(models.Issue, dbIssue.id, {
436+
status: constants.ISSUE_STATUS.CHALLENGE_CANCELLED,
437+
updatedAt: new Date()
438+
});
437439
return;
438440
}
439441

@@ -525,6 +527,9 @@ async function handleIssueClose(event, issue) { // eslint-disable-line
525527
// activate challenge
526528
if (challenge.status === 'Draft') {
527529
await topcoderApiHelper.activateChallenge(dbIssue.challengeUUID);
530+
//HACK - sleep 30 seconds so the legacy processor has time to "catch up"
531+
logger.debugWithContext('Sleeping for 30 seconds after activation so everything propagates...', event, issue);
532+
await new Promise(resolve => setTimeout(resolve, 30000));
528533
}
529534

530535
logger.debugWithContext(`Closing challenge with winner ${assigneeMember.topcoderUsername}(${winnerId})`, event, issue);

0 commit comments

Comments
 (0)