-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watcher Refactor #3447
Comments
About watching all projects, I'd be very happy if we could limit it to the currently active project. Originally it served a more important purpose, and I can picture a future where we might want it again, but even so it would need to do so selectively. Let's simplify for now and re-introduce later if needed? |
Thanks for sharing! |
I think with the two PRs merged, this tracking issue can be considered resolved. The one remaining issue related to the watcher (#3447) needs feedback, as it couldn't be reproduced. |
This issue keeps track of initial research to understand
watcher.rs
better, with the intend to formulate a plan to revise it, and make it more maintainable in the process.PRs
tauri/watcher
into crate #3541Refactor opportunities fixed In PRs
try_from()
which should rather benew()
for better readability of what's going on.try_from
is still called by hand each time, sonew()
is really the intend here.Allow handlers to be stopped using a message/event through a channel. They are already using this, and all it takes is to expose it. That wayWatcher
doesn't have to beClone
, which makesWatcherInner
obsolete, removing a level of indirection.Clone
is still required. All abstractions were removed though.Handler
should gain a method that has all the code currently distributed in varioushandlers
modules, then can also reuse more state, like opened git repositories. This would also do away withArc<Mutex>>
, which I doubt are necessary everywhere. It doesn't need to be clone anymore either.handle()
method.The internal message queue… it probably resolves itself then.- a channel is still used to communicate with this long-running process.Watcher
, depending on the project.Issues related to watcher
Discovered Issues
Issues (re)discovered during the watcher refactoring, but not related to the watcher alone.
git::credential::Helpers::from_path()
is used in tests, but depends on the actualHOME
environment variables, isn't isolatedfrom_path()
implementations as well.Notes
The notes here are partially derived from my notes branch.
Watcher
isClone
to make it possible to keep track of it, and to supervise it to deal with its error code. These run forever though, and are never removed, so it seems OK to not track them in the first place. And if communication is needed, this should be done with a channel of some sort. The tracing can then happen as part of instrumentation or dedicated tracing in the watcher impl itself.Clone
,WatcherInner
can becomeWatcher
(CancellationToken isn'tClone
)CancellationToken
is used tostop()
watchers, which happens only on project-deregistrationHandler
is abstracting multiple different 'logic' implementations, and I have a feeling that maybe these can be combined into one handler method, that calls other methods, which do the job. That would also allow these to reuse state and not open a repository each time. It's clearly an 'object oriented' approach which actively hurts usability as state is hard and is actively worked around withArc<Mutex>>
everywhere.The text was updated successfully, but these errors were encountered: