Closed romibuzi closed 8 years ago
hey @Romibuzi I dont think it's a good idea. I want the lib be usable in long running command. Check how we use the lib in our sf2 bundle https://github.com/M6Web/StatsdBundle, me manage to open and close the socket just one time per thread. Actually, you don't have to call ->send() each time you call ->increment() or other methods.
Hey @omansour, thank you for your feedback !
Indeed if you call only send()
one time at the end it will open and close just one socket, i was not sure of this behavior
Actually if we got X data to send on statsd, the client will open and close X sockets to the statsd server.
This PR modifies this behavior to 'persist' socket between each date write.
The downsite I see is in case of long running PHP jobs, where it can not be a nice thing to let socket opened for a long time. But in a web context, it's nice.