maxcnunes / waitforit

Wait until an address become available.
MIT License
172 stars 26 forks source link

Add an optional retry timeout parameter #15

Closed hazen closed 6 years ago

hazen commented 6 years ago

This will allow the time between retries to be specified. It is useful for services which are slow in responding to avoid hammering the down service.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.7%) to 59.887% when pulling 9e1eab316b337488c794c14f195b896930d16056 on auth0:add-retry-interval into 66f55e421a3778c0ab5792770d5c5992dcac8f1d on maxcnunes:master.

maxcnunes commented 6 years ago

@javajolt You should be able to achieve the same result just by increasing the timeout. If you want to allow 50 retries with a 20s timeout, seems you could just use a 1000s timeout instead.

hazen commented 6 years ago

Thanks for the feedback, @maxcnunes. The use case I'm trying to address here is a slowly starting service which needs very infrequent checks. The default was filling our logs with retry messages, but if we can back off the retry interval, then we get fewer messages. We still like the messages, just fewer of them. Also it is less resource-intensive by polling the local service less frequently. It seems to work for our development needs.

Maybe there was some configuration I was missing or misunderstanding. The sleep interval looked fixed it me.

maxcnunes commented 6 years ago

Alright, that seems reasonable. Thanks for the PR 👏 I will just cover that new part with unit tests before publishing it.