Fix/130 ignore socket errors
This PR adds a way to ignore the dreaded socket.gaierror error when initializing the UDP client and a server is missing.
- Fixes https://github.com/jsocol/pystatsd/issues/130
- (Hopefully) fixes https://github.com/jsocol/pystatsd/issues/125
Details
The new constructor signature is:
StatsClient(host='localhost', port=8125, prefix=None, maxudpsize=512, ignore_socket_errors=False)
To complement this flag, I added the is_ready property and the reset() method to clients.
On the UDP client:
- By default, the client will work as usual. When passing
ignore_socket_errors=True, errors during the socket initialization will be ignored. - The
is_readyproperty will reflect the state after the initialization. - In order to be able to recover from a failed initialization you can use the
reset()method.
On streaming clients:
- They will work as usual (won't ignore errors)
-
is_readyreflects the current status of the inner socket. -
reset()callsreconnect()under the hood.
Extra
I added a quick Travis detection to skip the tests dynamically.
Hi @jsocol, I've been waiting for your review on this PR and wanted to check if there's any feedback or changes needed to move it forward. I understand there may be other priorities, but if you need any clarification or additional information, I’d be happy to provide it :)
Closing this. It seems the repo is unattended.