From 4824f96246bfc553c9bc08691ac9a6ba6fa7af26 Mon Sep 17 00:00:00 2001 From: Lode Hoste Date: Sun, 19 Apr 2015 22:50:14 +0200 Subject: [PATCH] Catch /rest/events timeout (fixes #44) --- syncwatcher.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/syncwatcher.go b/syncwatcher.go index 5eb1aa8..92dccd0 100644 --- a/syncwatcher.go +++ b/syncwatcher.go @@ -96,7 +96,7 @@ var ( // HTTP Timeouts var ( - requestTimeout = 30 * time.Second + requestTimeout = 180 * time.Second ) // HTTP Debounce @@ -688,6 +688,11 @@ func watchSTEvents(stChans map[string]chan STEvent, folders []FolderConfiguratio for { events, err := getSTEvents(lastSeenID) if err != nil { + // Work-around for Go <1.5 (https://github.com/golang/go/issues/9405) + if strings.Contains(err.Error(), "use of closed network connection") { + continue + } + // Syncthing probably restarted Debug.Println("Resetting STEvents", err) lastSeenID = 0