Skip to content

Commit 66c4d45

Browse files
committed
Fix for waiting for team : return in readiness check added
1 parent b57f799 commit 66c4d45

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

wrongsecrets-balancer/src/kubernetes.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1299,11 +1299,10 @@ const deleteDesktopPodForTeam = async (team) => {
12991299
module.exports.deleteDesktopPodForTeam = deleteDesktopPodForTeam;
13001300

13011301
const getJuiceShopInstanceForTeamname = (teamname) => {
1302-
logger.info('checking readiness');
1303-
k8sAppsApi
1302+
logger.info(`checking readiness for ${teamname}`);
1303+
return k8sAppsApi
13041304
.readNamespacedDeployment(`t-${teamname}-wrongsecrets`, `t-${teamname}`)
13051305
.then((res) => {
1306-
logger.info(JSON.stringify(res));
13071306
if (
13081307
Object.prototype.hasOwnProperty.call(res.body, 'metadata') &&
13091308
Object.prototype.hasOwnProperty.call(res.body.metadata, 'annotations')

wrongsecrets-balancer/src/teams/teams.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ async function resetPasscode(req, res) {
514514
error
515515
)}`
516516
);
517-
// logger.error(error.message);
518517
return res.status(500).send({ message: 'Unknown error while resetting passcode.' });
519518
}
520519
}
@@ -537,16 +536,16 @@ async function awaitReadiness(req, res) {
537536
return res.status(200).send();
538537
}
539538

540-
await sleep(1000);
539+
await sleep(4000);
541540

542-
logger.error(`Waiting for deployment of team '${team}' timed out`);
543-
res.status(500).send({ message: 'Waiting for Deployment Readiness Timed Out' });
544541
} catch (error) {
545542
logger.error(`Failed to wait for teams '${team}' deployment to get ready: ${error}`);
546543
logger.error(error);
547-
res.status(500).send({ message: 'Failed to Wait For Deployment Readiness' });
544+
return res.status(500).send({ message: 'Failed to Wait For Deployment Readiness' });
548545
}
549546
}
547+
logger.error(`Waiting for deployment of team '${team}' timed out`);
548+
return res.status(500).send({ message: 'Waiting for Deployment Readiness Timed Out' });
550549
}
551550

552551
/**

0 commit comments

Comments
 (0)