Is there a way to extend polling interval after file watching was started? #1144
tukusejssirs
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to monitor a remote CIFS share via SMB (remote host is a Windows computer, local host is a Linux server). As there are some issues with files updating over the time, I’d like to implement mount-watch-umount-sleep loop:
usePolling
set totrue
, andinterval
andbinaryInterval
set to 30 minutes (30*60*1000
), which is the sleep time I want to implement, during which Chokidar should not watch the files;I see a potential issue when the remote is offline at the time when Chokidar is supposed to detect the file/folder changes: Chokidar would consider all files/folders to be deleted. Therefore I’d like to either skip the current check (and thus ‘sleep’ until the next change check instance) or extend the polling interval by another 30 minutes, or (re-)set a specific time when the next change check should occur.
I’ve also read something about
throttle
, which might a solution, however, I don’t really think so.Thanks for any help! 😃
Update: Another option I could see is to dump the Chokidar cache (or whatever you call it) of the current state of files and folder in the watched folder, stop watching files by Chokidar, then umount the share, wait/sleep for the next check time, mount the share, start another instance of Chokidar and supply it the dump. However, I have no idea how to accomplish this using Chokidar (I can probably make it directly, however, I don’t want to reinvent the wheel, as the file/folder monitoring feature of Chokidar works excelently).
Update 2: Or another way: add a rule/constraint when the file watching should done. I’d set it to check if the remote share is mounted at particular local path. Then I wouldn’t need to make Chokidar sleep/wait.
Beta Was this translation helpful? Give feedback.
All reactions