Browse Source

Weather: Wait a bit before refreshing when network connectivity is restored

This is so that we avoid a situation where the browser was looping on
trying to display the error page. Each navigation request was
erroring out, and the error said something along the lines of
"Your computer went to sleep". Indeed, this bug could be reproduced by
hibernating the computer and then waking it up - it seemed to occur
pretty frequently, especially on battery, when the power budget is more
constrained, and thus the speed of the PC as well. Hopefully, this
commit and the previous one addresses this issue.
pull/1138/head
Valentin Radu 4 years ago
parent
commit
da3fece8cd
  1. 3
      ep_weather_host/ep_weather_host.c

3
ep_weather_host/ep_weather_host.c

@ -75,7 +75,8 @@ HRESULT STDMETHODCALLTYPE INetworkListManagerEvents_ConnectivityChanged(void* _t
{ {
printf("[Network Events] Internet connection status is: Available.\n"); printf("[Network Events] Internet connection status is: Available.\n");
LONG64 dwUpdateSchedule = InterlockedAdd64(&_this->dwUpdateSchedule, 0); LONG64 dwUpdateSchedule = InterlockedAdd64(&_this->dwUpdateSchedule, 0);
PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0); SetTimer(_this->hWnd, EP_WEATHER_TIMER_REQUEST_REFRESH, EP_WEATHER_TIMER_REQUEST_REFRESH_DELAY, NULL);
//PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);
SetTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH, dwUpdateSchedule, NULL); SetTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH, dwUpdateSchedule, NULL);
printf("[Network Events] Reinstalled refresh timer.\n"); printf("[Network Events] Reinstalled refresh timer.\n");
} }

Loading…
Cancel
Save