Explorar o código

cmd/syncthing: Avoid Keepalive/GUI refresh race

This avoids unnecessary browser request failures and retries. Eg:
- Browser reuses existing HTTP connection for GUI refresh request
- Server closes connection with request in flight
- Browser retries GET request.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3854
Mark Pulford %!s(int64=8) %!d(string=hai) anos
pai
achega
69ae4aa024
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      cmd/syncthing/gui.go

+ 4 - 2
cmd/syncthing/gui.go

@@ -326,8 +326,10 @@ func (s *apiService) Serve() {
 	handler = debugMiddleware(handler)
 	handler = debugMiddleware(handler)
 
 
 	srv := http.Server{
 	srv := http.Server{
-		Handler:     handler,
-		ReadTimeout: 10 * time.Second,
+		Handler: handler,
+		// ReadTimeout must be longer than SyncthingController $scope.refresh
+		// interval to avoid HTTP keepalive/GUI refresh race.
+		ReadTimeout: 15 * time.Second,
 	}
 	}
 
 
 	s.fss = newFolderSummaryService(s.cfg, s.model)
 	s.fss = newFolderSummaryService(s.cfg, s.model)