Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
fix: prefer the create method
Browse files Browse the repository at this point in the history
avoids the host resolver preventing flushing of the queued up metrics
in some cases

fixes #840
  • Loading branch information
pjenvey committed Mar 8, 2017
1 parent d9f862c commit e7b34c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autopush/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def timing(self, name, duration, **kwargs):
class TwistedMetrics(object):
"""Twisted implementation of statsd output"""
def __init__(self, statsd_host="localhost", statsd_port=8125):
self.client = TwistedStatsDClient(statsd_host, statsd_port)
self.client = TwistedStatsDClient.create(statsd_host, statsd_port)
self._metric = Metrics(connection=self.client, namespace="autopush")

def start(self):
Expand Down
2 changes: 1 addition & 1 deletion autopush/tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TwistedMetricsTestCase(unittest.TestCase):
@patch("autopush.metrics.reactor")
def test_basic(self, mock_reactor):
twisted.internet.base.DelayedCall.debug = True
m = TwistedMetrics()
m = TwistedMetrics('127.0.0.1')
m.start()
ok_(len(mock_reactor.mock_calls) > 0)
m._metric = Mock()
Expand Down

0 comments on commit e7b34c3

Please sign in to comment.