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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slow SNTP sync from cold boot #1325

Merged
merged 1 commit into from
Dec 22, 2024
Merged

Conversation

petermm
Copy link
Contributor

@petermm petermm commented Oct 13, 2024

using ap_sta_network example https://github.com/atomvm/AtomVM/blob/release-0.6/examples/erlang/esp32/ap_sta_network.erl

testing on real devices (and hundreds of wokwi ci runs) - a cold boot often produces a significant wait for sntp sync: 20-30 seconds.

calling esp_sntp_restart() on the got_ip event fixes this. the function is noop if sntp is not init'ed/config'ed. https://github.com/espressif/esp-idf/blob/707d097b01756687cca18be855a2675d150247ae/components/lwip/apps/sntp/sntp.c#L123

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

Copy link
Collaborator

@bettio bettio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks safe, but I would avoid any last minute change before release.

@petermm petermm force-pushed the fix-slow-cold-sntp branch from 32866a1 to e1e48ea Compare October 25, 2024 12:10
@petermm petermm changed the base branch from release-0.6 to main October 25, 2024 12:10
@petermm petermm force-pushed the fix-slow-cold-sntp branch 2 times, most recently from 0d3cd7d to f2b2f83 Compare December 21, 2024 20:18
using ap_sta_network example https://github.com/atomvm/AtomVM/blob/release-0.6/examples/erlang/esp32/ap_sta_network.erl

testing on real devices (and hundreds of wokwi ci runs) - a cold boot often produces a significant wait for sntp sync: 20-30 seconds.

calling esp_sntp_restart() on the got_ip event fixes this. the function is noop if sntp is not init'ed/config'ed.
https://github.com/espressif/esp-idf/blob/707d097b01756687cca18be855a2675d150247ae/components/lwip/apps/sntp/sntp.c#L123

Signed-off-by: Peter M <petermm@gmail.com>
@petermm
Copy link
Contributor Author

petermm commented Dec 22, 2024

Should we land this in release-0.6?

@bettio
Copy link
Collaborator

bettio commented Dec 22, 2024

Should we land this in release-0.6?

No, honestly I would just add urgent fixes to release-0.6, documentation improvements or any CI tweaking.

@bettio bettio merged commit d441c3a into atomvm:main Dec 22, 2024
26 checks passed
@petermm petermm deleted the fix-slow-cold-sntp branch December 22, 2024 13:33
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.

3 participants