-
Notifications
You must be signed in to change notification settings - Fork 445
Refactor HookupHandlers in order accurately wrap tasks #419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've looked at this PR, but don't feel I understand the ITask
infrastructure well enough to give it the green light. I'll leave giving the thumbs up to someone more familiar with this.
@jcansdale The The task classes shown here are implementations of
Which actually all brings me to a question: @StanleyGoldman feels like you're wanting to stop the watcher before |
var task = GitClient.AddAll() | ||
.Then(GitClient.Commit(message, body)); | ||
|
||
HookupHandlers(task, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmmm this will only hook up handlers for the Commit
task, not the AddAll
task (which will also fire events). Is that what we want? If we want to handle the whole chain of tasks in one go, we can hook up to the Start
of the AddAll
task and do a Finally
on the Commit
one (so that if the AddAll
fails we can still reset the busy state and restart the watcher - if the AddAll
fails the Commit
will never start so handlers in HookupHandlers
for it will never run.
I added a test that demonstrates what @shana was saying in her previous comment. Unity/src/tests/TaskSystemIntegrationTests/Tests.cs Lines 111 to 147 in 134558c
I have to fix the code. |
HookupHandlers has will disable the repository watcher and toggle the busy flag by default. Tasks that directly cause changes to the file system should toggle the stop watcher flag. The only tasks that are called from RepositoryManager and do not directly cause changes are: - GitStatusTask - GitFetchTask - GitPushTask - GitRemoteAdd - GitRemoteRemove - GitRemoteChange - GitDeleteBranch - GitCreateBranch - GitLockTask - GitUnlockTask - GitLogTask - GitListLocksTask Tasks that are exclusive or batches of exclusive operations should toggle the busy flag. The only tasks that are called from RepositoryManager and are not exclusive are: - GitLogTask - GitListLocksTask
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a very clean approach.
Fixes #424
HookupHandlers
was refactored to use the task system in order to accurately wrap operations performed inRepositoryManager
.Tasks that are exclusive or batches of exclusive operations should toggle the busy flag.
Tasks that directly cause changes to the file system should stop the watcher.