diff options
author | Jakob Borg <jakob@nym.se> | 2014-06-26 11:24:38 +0200 |
---|---|---|
committer | Jakob Borg <jakob@nym.se> | 2014-06-26 11:29:41 +0200 |
commit | a2da31056b3ef6d619feb542552c0c82274a50eb (patch) | |
tree | be5e5032f5e7eccda30a209431fff4afe4663700 | |
parent | 2383579a6457ce8763e904f0f3e36fb507d0aaf4 (diff) |
Increase deadlock timeout, make configurable (fixes #389, fixes #393)v0.8.17
-rw-r--r-- | cmd/syncthing/main.go | 4 | ||||
-rw-r--r-- | model/model.go | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 0efa8afb12..d5fc32aae9 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -115,7 +115,9 @@ The following enviroment variables are interpreted by syncthing: STCPUPROFILE Write CPU profile to the specified file. - STGUIASSETS Directory to load GUI assets from. Overrides compiled in assets.` + STGUIASSETS Directory to load GUI assets from. Overrides compiled in assets. + + STDEADLOCKTIMEOUT Alter deadlock detection timeout (seconds; default 1200).` ) func init() { diff --git a/model/model.go b/model/model.go index 7cabbcc9d0..a05de8afd9 100644 --- a/model/model.go +++ b/model/model.go @@ -13,6 +13,7 @@ import ( "net" "os" "path/filepath" + "strconv" "sync" "time" @@ -97,9 +98,16 @@ func NewModel(indexDir string, cfg *config.Configuration, clientName, clientVers sup: suppressor{threshold: int64(cfg.Options.MaxChangeKbps)}, } - deadlockDetect(&m.rmut, 60*time.Second) - deadlockDetect(&m.smut, 60*time.Second) - deadlockDetect(&m.pmut, 60*time.Second) + var timeout = 20 * 60 // seconds + if t := os.Getenv("STDEADLOCKTIMEOUT"); len(t) > 0 { + it, err := strconv.Atoi(t) + if err == nil { + timeout = it + } + } + deadlockDetect(&m.rmut, time.Duration(timeout)*time.Second) + deadlockDetect(&m.smut, time.Duration(timeout)*time.Second) + deadlockDetect(&m.pmut, time.Duration(timeout)*time.Second) go m.broadcastIndexLoop() return m } |