Skip to content

Commit

Permalink
Merge pull request #264 from Tenzer/avoid-empty-packets
Browse files Browse the repository at this point in the history
Check if there are packets to send before sending an empty UDP packet
  • Loading branch information
yannmh authored Oct 19, 2018
2 parents ad3d280 + 589ca22 commit 24ed1ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion datadog/dogstatsd/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ def close_buffer(self):
Flush the buffer and switch back to single metric packets.
"""
self._send = self._send_to_server
self._flush_buffer()

if self.buffer:
# Only send packets if there are packets to send
self._flush_buffer()

def gauge(self, metric, value, tags=None, sample_rate=1):
"""
Expand Down

0 comments on commit 24ed1ef

Please sign in to comment.