mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-17 05:06:17 +02:00
Fix monitor response time
This commit is contained in:
parent
b4c10e6eee
commit
b3fce58c73
|
@ -488,7 +488,9 @@ final class Monitor {
|
|||
|
||||
while (true) {
|
||||
bool hasNotification = false;
|
||||
while (true) {
|
||||
int sleep_counter = 0;
|
||||
// Batch events up to 5 seconds
|
||||
while (sleep_counter < 5) {
|
||||
int ret = poll(&fds, 1, 0);
|
||||
if (ret == -1) throw new MonitorException("poll failed");
|
||||
else if (ret == 0) break; // no events available
|
||||
|
@ -621,8 +623,13 @@ final class Monitor {
|
|||
skip:
|
||||
i += inotify_event.sizeof + event.len;
|
||||
}
|
||||
|
||||
// Sleep for one second to prevent missing fast-changing events.
|
||||
if (poll(&fds, 1, 0) == 0) {
|
||||
sleep_counter += 1;
|
||||
Thread.sleep(dur!"seconds"(1));
|
||||
}
|
||||
}
|
||||
if (!hasNotification) break;
|
||||
processChanges();
|
||||
|
||||
|
|
Loading…
Reference in a new issue