From 15d3a233513bf75425b734eb252f7707b2b4e1f0 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Tue, 14 Jun 2022 17:43:26 +0100 Subject: [PATCH] Make all the checks run async --- handler/lib/money.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/handler/lib/money.py b/handler/lib/money.py index ed741a2..1724251 100644 --- a/handler/lib/money.py +++ b/handler/lib/money.py @@ -60,17 +60,21 @@ class Money(util.Base): # a_certs=ca_certs_path, ) + @inlineCallbacks def run_checks_in_thread(self): """ Run all the balance checks that output into ES in another thread. """ - self.get_total() - self.get_remaining() - self.get_profit() - self.get_profit(True) - self.get_open_trades_usd() - self.get_total_remaining() - self.get_total_with_trades() + total = self.get_total() + remaining = self.get_remaining() + profit = self.get_profit() + profit_with_trades = self.get_profit(True) + open_trades = self.get_open_trades_usd() + total_remaining = self.get_total_remaining() + total_with_trades = self.get_total_with_trades() + # This will make them all run concurrently, hopefully not hitting rate limits + for x in (total, remaining, profit, profit_with_trades, open_trades, total_remaining, total_with_trades): + yield x def setup_loops(self): """