Name: poll-endpoint-for
Owner: NOMS Digital Studio
Description: A simple utility that waits for a deployment to finish and then start polling a health endpoint
Created: 2017-04-11 14:19:49.0
Updated: 2017-04-11 19:51:54.0
Pushed: 2017-04-12 12:44:33.0
Size: 37
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A simple configurable utility script that continuously polls an endpoint until the response contains/matches all the fields asked for.
rn add poll-endpoint-for
-
m install --save poll-endpoint-for
pollEndpointFor takes two arguments
t pollEndpointFor = require('poll-endpoint-for');
EndpointFor(
{ status: 'OK' },
{
url: 'http://foo-url.com/health',
initialWait: 15,
requestInterval: 10,
retryCount: 1,
onSuccess: () => { console.log('I worked!') },
onError: () => { console.log('I failed') }
logger: (...args) => { console.info(...args)}
}
url: (string), // full url for the endpoint
initialWait: (int), // time in ms
requestInterval: (int), // time in ms
timeoutResponse: (int), // time in ms (sets maximum time to wait for the first byte to arrive from the server)
timeoutDeadline: (int), // time in ms (sets a deadline for the entire request (including all redirects) to complete)
retryCount: (int), // amount of times to retry a request
onSuccess: (func), // callback called when the endpoint request matches
onError: (func), // callback called when the endpoint reaches it's count limit without success
logger: (func) // callback used to override the default logger
rn test
(The MIT License)