File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -670,7 +670,19 @@ void setTimeZone(void * parameter) {
670670 // lookup current timezone
671671 httpClient.setFollowRedirects (HTTPC_STRICT_FOLLOW_REDIRECTS);
672672 httpClient.begin (" http://worldtimeapi.org/api/ip" );
673- int httpCode = httpClient.GET (); // Make the request
673+ int httpCode, i;
674+ for (i=0 ; i<15 ; i++) {
675+ httpCode = httpClient.GET (); // Make the request
676+ // only handle 200/301, fail on everything else
677+ if ( httpCode != HTTP_CODE_OK && httpCode != HTTP_CODE_MOVED_PERMANENTLY ) { // fail
678+ // httpClient.end();
679+ _LOG_A (" Error on HTTP request (httpCode=%i), try=%i.\n " , httpCode, i);
680+ delay (1000 );
681+ // httpClient.begin("http://worldtimeapi.org/api/ip");
682+ } else {
683+ break ;
684+ }
685+ }
674686
675687 // only handle 200/301, fail on everything else
676688 if ( httpCode != HTTP_CODE_OK && httpCode != HTTP_CODE_MOVED_PERMANENTLY ) {
You can’t perform that action at this time.
0 commit comments