Skip to content

Commit

Permalink
Fix for waiting for team : return in readiness check added
Browse files Browse the repository at this point in the history
  • Loading branch information
commjoen committed May 3, 2023
1 parent b57f799 commit 66c4d45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions wrongsecrets-balancer/src/kubernetes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1299,11 +1299,10 @@ const deleteDesktopPodForTeam = async (team) => {
module.exports.deleteDesktopPodForTeam = deleteDesktopPodForTeam;

const getJuiceShopInstanceForTeamname = (teamname) => {
logger.info('checking readiness');
k8sAppsApi
logger.info(`checking readiness for ${teamname}`);
return k8sAppsApi
.readNamespacedDeployment(`t-${teamname}-wrongsecrets`, `t-${teamname}`)
.then((res) => {
logger.info(JSON.stringify(res));
if (
Object.prototype.hasOwnProperty.call(res.body, 'metadata') &&
Object.prototype.hasOwnProperty.call(res.body.metadata, 'annotations')
Expand Down
9 changes: 4 additions & 5 deletions wrongsecrets-balancer/src/teams/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ async function resetPasscode(req, res) {
error
)}`
);
// logger.error(error.message);
return res.status(500).send({ message: 'Unknown error while resetting passcode.' });
}
}
Expand All @@ -537,16 +536,16 @@ async function awaitReadiness(req, res) {
return res.status(200).send();
}

await sleep(1000);
await sleep(4000);

logger.error(`Waiting for deployment of team '${team}' timed out`);
res.status(500).send({ message: 'Waiting for Deployment Readiness Timed Out' });
} catch (error) {
logger.error(`Failed to wait for teams '${team}' deployment to get ready: ${error}`);
logger.error(error);
res.status(500).send({ message: 'Failed to Wait For Deployment Readiness' });
return res.status(500).send({ message: 'Failed to Wait For Deployment Readiness' });
}
}
logger.error(`Waiting for deployment of team '${team}' timed out`);
return res.status(500).send({ message: 'Waiting for Deployment Readiness Timed Out' });
}

/**
Expand Down

0 comments on commit 66c4d45

Please sign in to comment.