From ca717e33d73527e1da5a8c151b993f344c2fcaf2 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Sat, 25 May 2013 13:51:52 +0100 Subject: [PATCH] Fix graphite stats sending --- fdroidserver/stats.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fdroidserver/stats.py b/fdroidserver/stats.py index f59d7a2c..73bf4631 100644 --- a/fdroidserver/stats.py +++ b/fdroidserver/stats.py @@ -32,14 +32,12 @@ import common import socket -carbon_socket = None def carbon_send(key, value): - global carbon_socket - if not carbon_socket: - carbon_socket = socket.socket() - carbon_socket = carbon_socket.connect((carbon_host, carbon_port)) - msg = '%s %d 42 %d\n' % (key, value, int(time.time())) - carbon_socket.sendall(msg) + s = socket.socket() + s.connect((carbon_host, carbon_port)) + msg = '%s %d %d\n' % (key, value, int(time.time())) + s.sendall(msg) + s.close() def main():