Skip to content

Instantly share code, notes, and snippets.

@talkol
Created October 22, 2016 17:54
Show Gist options
  • Select an option

  • Save talkol/4818c91d2244c8bf5ef91e1ea33cb916 to your computer and use it in GitHub Desktop.

Select an option

Save talkol/4818c91d2244c8bf5ef91e1ea33cb916 to your computer and use it in GitHub Desktop.
function pingServers(servers) {
let failedServers = {};
for (const url of servers) {
let failures = 0;
for (let i = 0 ; i < 3 ; i++) {
const response = blockingHttpRequest(url);
if (!response.ok) failures++;
blockingSleep(10000);
}
if (failures > 0) failedServers[url] = failures;
}
return failedServers;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment