search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

AutoRefresh Interval

Asked by Anonymous
6 years ago.

Hello,

I am using DayPilot.Web.MVC version 8.4.5884.1 and daypilot-all.min.js version 2955.

I am trying to use AutoRefresh, by setting:

View:

AutoRefreshEnabled = true,
AutoRefreshInterval = 30,

Controller:

switch (e.Command)
{
case "refresh":
UpdateWithMessage("Refreshed");
break;
}

It's working properly for the first few calls, after for example 5 calls the refresh interval keeps increasing until never call the refresh again.

I already tested without do anything on the scheduler and also creating, editing events, both the refresh stops work after few calls.

Do I need to resume the autorefresh at some point? or is it required to set AutoRefreshMaxCount?

Thanks for the reply.

mvc
Answer posted by Dan Letecky [DayPilot]
6 years ago.

1. The default AutoRefreshMaxCount value is set to 20. That means it will stop calling the Refresh event after that number.

This limit is introduced intentionally - calling any JavaScript code repeatedly requires that it's 100% free of memory leaks and any other performance problems. Even a small flaw (inside DayPilot or in your code) would be multiplied and it would eventually crash the browser.

Keeping many auto-refreshing clients open can also affect server performance.

Refreshing the Scheduler using pull method (like in this case) is very inefficient. The only advantage is that it's easy to implement. For serious application it would be necessary to switch to a socket-based notification (like SignalR).

2. Anyway, the Scheduler should keep calling the Refresh event until AutoRefreshMaxCount is reached. I tried to reproduce the problem using the demo at https://mvc.daypilot.org/demo/Scheduler/AutoRefresh. After increasing AutoRefreshMaxCount to 500 it keeps refreshing for at least 30 minutes (every 10 seconds). Tested in Chrome.

Are you able to reproduce the problem using the demo?

3. Please note that recent browser versions may limit the usage of setTimeout() and setInterval() - especially for tabs that are not active. The reason is exactly the same as in #1 - having a couple of tabs periodically processing something would easily kill the browser (even without memory leaks).

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.