Browse Source

Fix flake8 again

changes/20/506120/1 0.0.1
Matthew Treinish 4 years ago
parent
commit
ea2bc36a72
No known key found for this signature in database GPG Key ID: FD12A0F214C9E177
  1. 3
      mqtt_statsd/daemon.py

3
mqtt_statsd/daemon.py

@ -49,12 +49,10 @@ class MQTTStat(threading.Thread):
self.client.username_pw_set(auth['username'],
password=auth.get('password'))
def run(self):
def on_connect(client, userdata, flags, rc):
client.subscribe(self.mqtt_topic)
def on_message(client, userdata, msg):
if self.statsd_type == 'gauge':
self.statsd_client.gauge(self.statsd_topic, msg.payload)
@ -62,6 +60,7 @@ class MQTTStat(threading.Thread):
self.statsd_client.timer(self.statsd_topic, msg.payload)
elif self.statsd_type == 'counter':
self.statsd_client.incr(self.statsd_topic)
self.client.on_connect = on_connect
self.client.on_message = on_message
self.client.connect(self.hostname, self.port)

Loading…
Cancel
Save