Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Issue with browser updating with datatable updates

$
0
0

@FreeLand wrote:

Currently I have an interval updated function e.g

@app.callback([Output(‘table’, ‘data’),
Output(‘table’, ‘columns’)],
[Input(‘interval-component’, ‘n_intervals’)])
def update_graph_live(n):

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:

def update_graph_live(n):
print(‘Updating Prices…’)
global then
global trigger
global balance
global loans

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.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images