diff --git a/src/pricing/collector.py b/src/pricing/collector.py index 6cf41c4..0985818 100644 --- a/src/pricing/collector.py +++ b/src/pricing/collector.py @@ -38,6 +38,7 @@ def averager(type): averagePrice = round(averagePrice, 2) log("Hourly Price for ({}) is {}".format(timestamp ,averagePrice), 'INFO') + sleep(0.05) return averagePrice, timestamp @@ -123,7 +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.05) log("Message: {}".format(message), 'INFO') + sleep(0.05) activeMQSender(messageJson) @@ -160,10 +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.05) # Dynamically Spin up Child process for each type wanting to track def collectorMain(c_type): log("== Historical Price Collector ==", 'INFO') + sleep(0.05) collector(c_type) diff --git a/src/utils/activemqConnect.py b/src/utils/activemqConnect.py index 4430167..d62e240 100644 --- a/src/utils/activemqConnect.py +++ b/src/utils/activemqConnect.py @@ -4,6 +4,7 @@ import stomp import os from src.utils.jsonLogger import log +from time import sleep class keys(): @@ -21,6 +22,8 @@ def activeMQSender(message): addr, port, mqUser, mqPass = keys().returnKeys() log("Attempting Connection to Artemis...", 'INFO') + sleep(0.05) + con = stomp.Connection([(addr, port)], auto_content_length=False) con.connect( mqUser, mqPass, wait=True)