This commit is contained in:
@@ -47,14 +47,15 @@ class MetadataPrefetcher:
|
|||||||
self._stop.set()
|
self._stop.set()
|
||||||
|
|
||||||
def _run_loop(self) -> None:
|
def _run_loop(self) -> None:
|
||||||
"""Background loop: wait, then run a scan."""
|
"""Background loop: run first scan immediately, then wait and repeat."""
|
||||||
while not self._stop.is_set():
|
while not self._stop.is_set():
|
||||||
|
self._run_scan()
|
||||||
|
if self._stop.is_set():
|
||||||
|
break
|
||||||
self._stop.wait(timeout=min(60, self._interval_sec))
|
self._stop.wait(timeout=min(60, self._interval_sec))
|
||||||
if self._stop.is_set():
|
if self._stop.is_set():
|
||||||
break
|
break
|
||||||
if self._stop.wait(timeout=max(0, self._interval_sec - 60)):
|
self._stop.wait(timeout=max(0, self._interval_sec - 60))
|
||||||
break
|
|
||||||
self._run_scan()
|
|
||||||
|
|
||||||
def _run_scan(self, scheduled: set | None = None) -> None:
|
def _run_scan(self, scheduled: set | None = None) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user