From cb909d856472a65adf08bd2cf1f70481bb6959cd Mon Sep 17 00:00:00 2001 From: Bernhard Guillon Date: Tue, 7 Jul 2026 20:07:44 +0200 Subject: Add -sync-timeout flag (default 10min) for slow initial syncs --- cmd_windows.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd_windows.go b/cmd_windows.go index 59df307..f76d95d 100644 --- a/cmd_windows.go +++ b/cmd_windows.go @@ -22,7 +22,8 @@ var ( sourceDir = flag.String("dir", "", "Source directory to watch (required)") connect = flag.String("connect", "localhost:5151", "TCP address of the container to connect to") bufSizeKB = flag.Int("bufsize", 256, "ReadDirectoryChangesW buffer size in KB per directory (default 256)") - dumpFile = flag.String("dump", "", "Dump whitelist/blacklist to file and exit") + dumpFile = flag.String("dump", "", "Dump whitelist/blacklist to file and exit") + syncTimeout = flag.Int("sync-timeout", 10, "Minutes to wait for server sync to complete") ) func run() { @@ -413,7 +414,7 @@ func sendEvent(conn net.Conn, evt FileEvent) error { func waitForSyncDone(conn net.Conn) error { scanner := bufio.NewScanner(conn) scanner.Buffer(make([]byte, 0, 1024*1024), 1024*1024) - conn.SetReadDeadline(time.Now().Add(10 * time.Minute)) // large repos can take a while + conn.SetReadDeadline(time.Now().Add(time.Duration(*syncTimeout) * time.Minute)) defer conn.SetReadDeadline(time.Time{}) for scanner.Scan() { msg, err := DecodeMessage(scanner.Bytes()) -- cgit v1.2.3