Revert "[06.10.20] Log timing and amq error handling"

This reverts commit 2f94bac9
This commit is contained in:
Andy Sotheran 2020-10-06 22:52:19 +01:00
parent 2f94bac950
commit d727655cdf
2 changed files with 13 additions and 20 deletions

View File

@ -38,7 +38,7 @@ def averager(type):
averagePrice = round(averagePrice, 2)
log("Hourly Price for ({}) is {}".format(timestamp ,averagePrice), 'INFO')
sleep(0.5)
sleep(0.05)
return averagePrice, timestamp
@ -124,9 +124,9 @@ def sentToArtemis(c_type, timestamp, av_price, high, low, vol, o_price, c_price)
messageJson = json.dumps(message, indent = 4)
log("Sending message to PricingSave queue", 'INFO')
sleep(0.5)
sleep(0.05)
log("Message: {}".format(message), 'INFO')
sleep(0.5)
sleep(0.05)
activeMQSender(messageJson)
@ -163,12 +163,12 @@ def collector(c_type):
schedule.every().hour.at(time).do(collector, c_type).tag("collector")
log("Collection will run again at {} every hour".format(time), 'INFO')
sleep(0.5)
sleep(0.05)
# Dynamically Spin up Child process for each type wanting to track
def collectorMain(c_type):
log("== Historical Price Collector ==", 'INFO')
sleep(0.5)
sleep(0.05)
collector(c_type)

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
import stomp
import os, sys
import os
from src.utils.jsonLogger import log
from time import sleep
@ -22,19 +22,12 @@ def activeMQSender(message):
addr, port, mqUser, mqPass = keys().returnKeys()
log("Attempting Connection to Artemis...", 'INFO')
sleep(1)
try:
sleep(0.05)
con = stomp.Connection([(addr, port)], auto_content_length=False)
try:
con.connect( mqUser, mqPass, wait=True)
con.send("PricingSave", message, content_type="application/json", headers={"Content-Type":"application/json"})
except:
e = sys.exc_info()[0]
log("And Error occurred when sending to AMQ :: {}".format(e), 'ERR')
con.disconnect()
con.disconnect()
except:
e = sys.exc_info()[0]
log("And Error occurred when connecting to AMQ :: {}".format(e), 'ERR')