Currently I have an interval updated function e.g
within this I am making calls to a database which I have set up via a trigger i.e after some time passes it will make calls to the database. I am using global variables here to do this so I know this is problematic to Dash. Example:
if trigger is True: print('Updating Database.....') hi.update_response() hi.return_prices() balance = balance_sql() loans = loans_sql() df = dataframe_manip(balance, loans, hi.get_base_price('XBT'),hi.get_base_price('BCH'),hi.get_base_price('ETH'),hi.get_base_price('ETHDEC'), hi.get_base_price('FLEX'),hi.get_base_price('BCHDEC'),hi.get_base_price('XBTDEC'), usdtoct_price) trigger = False now = datetime.utcnow() then = now+timedelta(minutes = 1.5) if datetime.utcnow() > then: trigger = True
balance_sql() makes the call to the database and returns a dataframe.
Within Update_graph_live I am also making GET requests to get other information, this is occuring every time the the interval occurs.
At the end of this function I return:
return new_frame.to_dict('rows'), columns_3
which then updates a DashTable.
What the issue is, is that this will successfully update my DashTable in the browser for a time of between 30 minutes and 2 hours before it just suddenly stops updating and becomes static with no updates thanks to the GET requests I make and no updates via the database pull. However I am sure the function is running as I have prints within it. Why is it stopping after a significant amount of time.
Thank you for reading this.