Fix updates timer.

This commit is contained in:
2023-11-07 17:46:09 +03:00
parent 4299d9b89f
commit 18959b1ef0

View File

@@ -237,10 +237,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (fCheckUpdates)
{
if (!SetTimer(hWnd, IDT_TIMER, 20000, NULL))
if (!SetTimer(hWnd, IDT_TIMER, 20000, NULL)) // 20 seconds
{
LOG_TO_FILE(L"%s(%d): Creating timer failed!", TEXT(__FUNCTION__), __LINE__);
ShowError(IDS_ERR_TIMER);
fCheckUpdates = FALSE;
}
LOG_TO_FILE(L"%s(%d): Timer successfully created", TEXT(__FUNCTION__), __LINE__);
}
@@ -273,9 +274,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (fCheckUpdates)
{
Sleep(10000); // 10 seconds
LOG_TO_FILE(L"%s(%d): Checking for updates is enabled, fCheckUpdates = %s", TEXT(__FUNCTION__), __LINE__, fCheckUpdates ? L"True" : L"False");
Sleep(10000);
hUpdater = CreateThread(NULL, 0, &Updater, nullptr, 0, nullptr);
if (NULL == hUpdater)
{
@@ -284,10 +286,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
else
{
if (!SetTimer(hWnd, IDT_TIMER, 86390000, NULL))
if (!SetTimer(hWnd, IDT_TIMER, 86390000, NULL)) // 1 day - 10 seconds
{
LOG_TO_FILE(L"%s(%d): Creating timer failed!", TEXT(__FUNCTION__), __LINE__);
ShowError(IDS_ERR_TIMER);
fCheckUpdates = FALSE;
}
LOG_TO_FILE(L"%s(%d): Timer successfully created", TEXT(__FUNCTION__), __LINE__);
}