Remove the declaration of global variables from the run method. #180

This commit is contained in:
Korina Cordero 2019-04-26 03:10:16 +00:00
parent d15099b456
commit 9503089642

View file

@ -12,14 +12,10 @@ import json
class RiderLocationCache(object): class RiderLocationCache(object):
def run(self): def run(self):
global client, redis_conn
client = mqtt.Client()
client.on_connect = on_connect client.on_connect = on_connect
# client.on_publish = on_publish # client.on_publish = on_publish
client.on_message = on_message client.on_message = on_message
redis_conn = redis.StrictRedis(host='localhost', port=6379, db=0)
#client.tls_set( #client.tls_set(
# "/etc/letsencrypt/live/resqaws.jankstudio.com/fullchain.pem", cert_reqs=ssl.CERT_NONE, # "/etc/letsencrypt/live/resqaws.jankstudio.com/fullchain.pem", cert_reqs=ssl.CERT_NONE,
# tls_version=ssl.PROTOCOL_TLSv1) # tls_version=ssl.PROTOCOL_TLSv1)
@ -36,6 +32,8 @@ class RiderLocationCache(object):
#signal.signal(signal.SIGINT, sigint_handler) #signal.signal(signal.SIGINT, sigint_handler)
client.loop_forever() client.loop_forever()
client = mqtt.Client()
redis_conn = redis.StrictRedis(host='localhost', port=6379, db=0)
def init_subscriptions(client): def init_subscriptions(client):
print "subscribing to wildcard" print "subscribing to wildcard"