question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best practices for live updates

See original GitHub issue

Hi,

I’m working on a dashboard that queries the database every 1 minute and updates various charts with the new data. I noticed some strange behavior with the live updates. Most of the time everything works fine, but occasionally some of the charts gets updated with old data (like, data that’s 5 or 10 minutes ago), which doesn’t make sense to me. Checked the database and the data there are always up to date.

Initially, I have set up callback functions for each of the charts with events=[Event('interval-component', 'interval')] as the trigger. I have a separate callback function which does the database query and updates data in a few global variables, which are used for charts plotting.

I suspect it might be due to some race condition problem - the charts are getting updated with the event trigger, but the data update has not finished yet. So I changed the condition for the callback. Now I have one callback function which gets triggered every one minute and pulls latest data (into global variables) from the database and updates a div on my page with a timestamp. Then, all the other charts watch the timstamp div and update themselves (using the global variables) if there is any changes. I thought this may ensure that my database query finishes first before the charts get updated. However, it seems it still has not solved the problem.

So I would like to know what is the best practice for handling such live updates. e.g.

  • Is it a good idea to store the data in global variables? I don’t want to have repeated database queries for each chart so I just want to do it in one go.
  • If events=[Event('interval-component', 'interval')] are used for updating multiple components, in what sequence does Dash execute the callback functions?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
chriddypcommented, Aug 9, 2017
1reaction
renardeinsidecommented, May 22, 2019

Hi, I’m now trying to use Dash with multiple Interval elements (with different update time), using the solution with gunicorn, but seems that it’s not working. Is there any solutions for multiple Interval?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tips and Best Practices to Boost Your Live Streaming Event
A good practice is to begin streaming well before the actual event starts. Industry experts recommend going live with a countdown and music...
Read more >
10 Facebook Live Tips and Best Practices - Constant Contact
1. Create talking points and a call to action ... Before you tap the Go Live button, you should decide what the purpose...
Read more >
Live Tweet Like a Pro: Tips + Examples for Your Next Event
8 tips for successfully live tweeting an event ... Try behind-the-scenes footage, updates, or powerful crowd reactions.
Read more >
Best practices to update a live web service - Server Fault
The first and most natural technique comes to the mind is that redirecting all the requests to some other replicated server, so that...
Read more >
What is a Live Blog? Know Everything About it - Arena.im
1. Identify live blog opportunities · 2. Install and test your live blog app · 3. Prepare posts and coverage in advance ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found