Repository navigation
all: Remove need to restart syncthing - #6883
Conversation
…once the process is running
|
Actually, crash reporting does not require restarts after all, as it's checked on every attempt to report them, and the attempts only happen on restarts. |
imsodin
left a comment
There was a problem hiding this comment.
Cool - thanks for tackling this longstanding (unnecessary) annoyance!
The whole connection-discovery-chicken-egg is ugly (discovery needing SetAddressLister to be called and to do the config subscription in exactly the order it is otherwise it panics). Given discovery is part of managing connections, I'd setup discovery in connections.NewService making connections the chicken and discovery one of its eggs.
The rest of the comments are just nits.
| // The Manager aggregates results from multiple Finders. Each Finder has | ||
| // an associated cache time and negative cache time. The cache time sets how | ||
| // long we cache and return successful lookup results, the negative cache | ||
| // time sets how long we refrain from asking about the same device ID after | ||
| // receiving a negative answer. The value of zero disables caching (positive | ||
| // or negative). |
There was a problem hiding this comment.
Sounds like caching times are configurable, while they are hardcoded. I'd just keep the generic explanation how the cache retention/eviction works without explicitly talking about associated times.
There was a problem hiding this comment.
To be honest, I think all of this is an explanation how it works.
|
I think the connection.NewService suggestion makes things worse, and breaks the nice dependency injection we have going on. I'd be unable to supply my own implementation of discover.Finder to it anymore. I have an alternative approach, which is a wrapper around addressLister, which initially has no implementation, and then I later set the implementation once connection service is created. This keeps the component APIs clean, and has a bit on ugly code in the wiring. I believe this is what other dependency injection frameworks like spring do in cases like this, that is create a proxy satisfying the interface, and wire it later. |
|
I guess we are getting a bit off-track here, given it's about not having to restart. And likely the issues have existed before this PR, the s/CachingMux/Manager/ change just prompted me to look at it - so feel free to skip any of this. |
|
So I am not going down that rabbit hole in this PR. My goal is to remove the need to restart with as minimal code changes as possible. If we want to refactor discovery, split stuff, give magic values constant names, I am fine with that, but not in this PR. This PR already touches other things other than discovery. |
imsodin
left a comment
There was a problem hiding this comment.
As I wrote, no need to go into that (I like to write up things I notice, if only because it sometimes makes me realize flaws in my thought process - I need to setup some personal code-linked note-taking). The new manager file not being picked up as similar enough, initially led me to believe you changed more than you really did (git diff main:lib/discover/cache.go lib/discover/manager.go is revealing).
imsodin
left a comment
There was a problem hiding this comment.
Thought I'd take it for a spin given I already checked the branch out for diffing and got a panic - investigating.
Co-authored-by: Simon Frei <[email protected]>
* main: (368 commits) build: We now target Go 1.14 lib/fs: Disable ioctl on ppc (fixes syncthing#6898) (syncthing#6901) gui, man, authors: Update docs, translations, and contributors lib/dialer: Try dialing without reuse in parallel (fixes syncthing#6892) (syncthing#6893) cmd/stcrashreceiver: Don't crash on nil err all: Remove need to restart syncthing (syncthing#6883) lib/db: Don't put truncated files (ref syncthing#6855, ref syncthing#6501) (syncthing#6888) lib/osutil: Check returned error instead of info (ref syncthing#6885) (syncthing#6887) gui, man, authors: Update docs, translations, and contributors lib/osutil: Preserve perms in AtomicWriter (fixes #tbd) (syncthing#6885) lib/fs: Fix WatchRename test for FreeBSD (fixes syncthing#6613) lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref syncthing#6875) (syncthing#6877) lib/model: Don't close file early (fixes syncthing#6875) (syncthing#6876) lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref syncthing#6875) (syncthing#6877) gui, man, authors: Update docs, translations, and contributors lib/fs: Fix WatchRename test for FreeBSD (fixes syncthing#6613) lib/model: Don't close file early (fixes syncthing#6875) (syncthing#6876) lib/db: Log context on panic (syncthing#6872) gui: Don't show pull order on SO folders (ref syncthing#6807) (syncthing#6871) lib/model: Check folder error before sync-waiting (fixes syncthing#6793) (syncthing#6847) ...
|
I don't think those required restart ever. |
This removes the need to restart syncthing in almost all cases.
The only two left are: