cmd/syncthing, lib/sync: Don't do deadlock detection when STDEADLOCKTIMEOUT=0 (fixes #4644)

Allows setting STDEADLOCKTIMEOUT=0 (or any integer <= 0) to disable the
deadlock detection entirely.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4673
This commit is contained in:
Jakob Borg
2018-01-15 13:33:52 +00:00
committed by Audrius Butkevicius
parent fcc6a677a5
commit 838c182b5b
2 changed files with 11 additions and 9 deletions

View File

@@ -770,10 +770,9 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
m := model.NewModel(cfg, myID, "syncthing", Version, ldb, protectedFiles)
if t := os.Getenv("STDEADLOCKTIMEOUT"); len(t) > 0 {
it, err := strconv.Atoi(t)
if err == nil {
m.StartDeadlockDetector(time.Duration(it) * time.Second)
if t := os.Getenv("STDEADLOCKTIMEOUT"); t != "" {
if secs, _ := strconv.Atoi(t); secs > 0 {
m.StartDeadlockDetector(time.Duration(secs) * time.Second)
}
} else if !IsRelease || IsBeta {
m.StartDeadlockDetector(20 * time.Minute)