niallo/node-httpcheck — pull request #1 by freeall (2014-01-14 10:01:53+00:00)
Title: Fixed interval check

There is a race condition if server replies slower than the checkInterval time frame.

This example shows when it goes wrong and the pull request fixes it.

``` js
var check = require('httpcheck');
var assert = require('assert');
var http = require('http');

http.createServer(function(request, response) {
setTimeout(function() {
response.end();
}, 1000);
}).listen(13532, function() {
var checks = 0;
check({
url: 'http://localhost:13532',
checkTries: 3,
checkInterval: 500
}, function() {
checks++;
assert(checks === 1);
});
});
```