Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Device Polling Rate #1149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

henjoe
Copy link

@henjoe henjoe commented Apr 9, 2024

On the device PollingRate, I noticed that if we set the rate into 5secs, and the Fuxa server start at 08:02, then the next polling rate will be 08:07, 08:12 , 08:17 and so on and so forth..

This request ensures that the polling rate will always be modulos to the pollingRate settings in the device.
If you set the rate to be 5secs, and the Fuxa server start at 08:02, then the next polling will be at 08:05, 08:10, 08:15 and so on and so forth...
Setting the pollingRate into 10 secs, then the polling will be modulos of 10 -> 08:10, 08:20, 08:30 and so on and so forth.

PS: Really new to Github, this is my first time to pull request, Apologies if I did something wrong or mistakes. 馃槃

@unocelli
Copy link
Member

Hi, Thanks for the PR.
I understand the issue, but I wonder if with this kind of approach we don't risk resource or performance problems in continuing to create timers?

@henjoe
Copy link
Author

henjoe commented Apr 26, 2024

Hi @unocelli , to be honest not really sure and haven't tested yet the performance about this. You might have good point on that.
How about this code here? I think this much similar to the existing except that we added condition to check if the current seconds in modulos to pollingInterval:

devicePolling = setInterval(function() {
var now = new Date()
if (now.getSeconds() % (pollingInterval/1000) === 0){
console.log(data.name + " " + new Date().toLocaleString() + "-->> " + (now.getSeconds() % (pollingInterval/1000) === 0))
self.polling();
}
},1000)

@unocelli
Copy link
Member

unocelli commented May 7, 2024

Hi, I suggest to make it configurable in _appdata/settings.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants