✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Dcc Interval not updating regularly

Hi all,
I’m using dcc.interval to update a table on a regular basis. I noticed that if other callbacks are fired in the application, even if not in parallel to the one from dcc.Interval, it interrupts the callbacks update of dcc.Interval for a while. Example below fires every 30s, but if I run another callback on a different component of the application, the next interval update can take place in 10mn (or even more).
I’m pasting the code in case I’m missing something.

table =dash_table.DataTable(
id=‘monitoring-inception-pl’,
columns=columns,
style_data_conditional=style_data_conditional,
sort_action=‘native’,
style_cell={‘textAlign’: ‘left’},
export_format=‘xlsx’,
export_headers=‘display’,
merge_duplicate_headers=True,
)
return html.Div([
dcc.Interval(
id=‘interval-update’,
interval= 30 * 1000, # in milliseconds
n_intervals=0
),
drc.Card([
html.P(
children=‘Daily Negative Client Flow’,
style={‘textAlign’: ‘center’, ‘width’: ‘105%’, ‘color’: ‘red’, ‘font-weight’: ‘bold’}
),
html.Div(
id=‘inception-last-ts-id’,
style={‘width’: ‘98%’, ‘margin’: 5, ‘textAlign’: ‘left’}
),
table,
], style={“min-height”: “auto!important”, “z-index”: “inherit !important”, “overflow”: “visible !important”})

this is the callback

@app.callback(
[Output(‘monitoring-inception-pl’, ‘data’), Output(‘inception-last-ts-id’, ‘children’)],
[Input(‘interval-update’, ‘n_intervals’)]
)
def updateNegativeInception(interval):
logging.info(“Inception negative P&L monitoring " + str(interval))
asOf = datetime.now().strftime(”%Y-%m-%d %H:%M:%S")

df = computeDF('tot', asOf, asOf)


lsr = [html.Tr(),html.P('Last run: ' + asOf, style={'color': 'black', 'font-weight': 'bold'})]




return [df.to_dict('records'), lsr]