Skip to content

Commit

Permalink
Fix problem with multiple deletes in test (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
fhinkel authored and Ace Nassri committed Nov 21, 2022
1 parent da52371 commit bffc92f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compute/startup-script/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ function createVm(name, callback) {
console.log('Booting new VM with IP http://' + ip + '...');

// Ping the VM to determine when the HTTP server is ready.
let waiting = true;
const timer = setInterval(
ip => {
http
.get('http://' + ip, res => {
const statusCode = res.statusCode;
if (statusCode === 200) {
if (statusCode === 200 && waiting) {
waiting = false;
clearTimeout(timer);
// HTTP server is ready.
console.log('Ready!');
Expand Down

0 comments on commit bffc92f

Please sign in to comment.