Skip to content

Commit

Permalink
Fix 30 seconds delay issue (#156)
Browse files Browse the repository at this point in the history
* reduce file monitor wait time

---------

Co-authored-by: Charity Kathure <ckathure@microsoft.com>
  • Loading branch information
CharityKathure and Charity Kathure authored Sep 4, 2023
1 parent 33b1a27 commit 1632af0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion LogMonitor/src/LogMonitor/LogFileMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ using namespace std;
/// \param LogDirectory: The log directory to be monitored
/// \param Filter: The filter to apply when looking fr log files
/// \param IncludeSubfolders: TRUE if subdirectories also needs to be monitored
/// \param WaitInSeconds: Waiting time in seconds to retry if folder/file to be monitored does not exist
///
LogFileMonitor::LogFileMonitor(_In_ const std::wstring& LogDirectory,
_In_ const std::wstring& Filter,
Expand Down Expand Up @@ -811,7 +812,7 @@ LogFileMonitor::LogFilesChangeHandler()
const DWORD eventsCount = 3;

LARGE_INTEGER liDueTime;
INT64 millisecondsToWait = 30000LL;
INT64 millisecondsToWait = 1000LL;
liDueTime.QuadPart = -millisecondsToWait*10000LL; // wait time in 100 nanoseconds

HANDLE timerEvent = CreateWaitableTimer(NULL, FALSE, NULL);
Expand Down Expand Up @@ -1010,6 +1011,8 @@ LogFileMonitor::LogFilesChangeHandler()
}
}

CloseHandle(timerEvent);

return status;
}

Expand Down

0 comments on commit 1632af0

Please sign in to comment.