NTPClient icon indicating copy to clipboard operation
NTPClient copied to clipboard

Re-works the update() method to avoid blocking

Open joshado opened this issue 5 years ago • 2 comments
trafficstars

I was seeing weird issues following an unrelated failed OTA update where the NTP update() call would block the loop() method for 1024ms whilst packets timed out despite seeing replies going back to the ESP.

This PR tweaks the update() method to work asynchronously rather than blocking things to implement the timeout which sorted things out for me.

In addition, it also adds a backoff to timeout so we don't end up in a state constantly hammering the NTP server.

I'm using these changes in my project and, if you think they'll be generally useful, you're welcome to them under the same MIT license as the original work.

Cheers.

joshado avatar Jan 28 '20 21:01 joshado

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 09 '21 13:04 CLAassistant

@joshado, good job, the changes you submitted match what I planned to implement too, but since you've already done it I thought I could use your changes.

Looks like your PR would have been accepted already, the only thing that is missing is signing CLA as requested above. Would you mind doing that so others could use your excellent work?

mlesniew avatar Jan 22 '22 14:01 mlesniew