- Notifications
You must be signed in to change notification settings - Fork3
chore: rework mutagen controller, add polling#65
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
deansheather commentedApr 1, 2025
- Use locks during operations for daemon process consistency
- Use a state model for UI rendering
- Use events to signal state changes
- Fix some tooltip problems that arise from polling
- Use locks during operations for daemon process consistency- Use a state model for UI rendering- Use events to signal state changes- Fix some tooltip problems that arise from polling
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
App/Services/MutagenController.cs Outdated
_state = state; | ||
// Since the event handlers could block (or call back the | ||
// CredentialManager and deadlock), we run these in a new task. | ||
if (StateChanged == null) return; |
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.
Don't we need to check if the state has actually changed?
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 decided not to implement equality for the state type because I would also need to implement equality for the sync session model (and all of it's sub types) which seems like a lot. I don't think there's any side effects of calling this every time it changes though
Uh oh!
There was an error while loading.Please reload this page.
App/Services/MutagenController.cs Outdated
// Since the event handlers could block (or call back the | ||
// CredentialManager and deadlock), we run these in a new task. | ||
if (StateChanged == null) return; | ||
Task.Run(() => { StateChanged?.Invoke(this, state); }); |
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.
Are Events threadsafe? If we start this in another task, could it be modified under us in a way that breaks stuff?
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'll copy the EventHandler to a variable before calling it, which I believe makes it thread safe
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.
LGTM