-
Notifications
You must be signed in to change notification settings - Fork 5
feat: make the observers asynchronous #12
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
base: main
Are you sure you want to change the base?
Conversation
Couple of thoughts:
|
I agree with your points. To address the concern about unnecessary complexity, I’ve updated the PR so that it no longer changes the core engine. Instead, I’ve introduced a |
} | ||
} | ||
|
||
func (a *asyncRoutineObserver) startObserving() { |
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 wonder if this be getting ctx as a parameter?
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.
What usage of the context are you thinking about?
Background
Previously, observers were invoked synchronously by the routine manager. This meant that if an observer was slow or blocking, it could negatively impact the performance and responsiveness of the entire routine management system.
Enhancement
This pull request introduces
NewAsyncRoutineObserver
, a wrapper that allows any existing observer to operate asynchronously. With this change:Key Benefits
Example
This ensures that observer notifications are handled off the main execution path, improving overall system robustness and scalability.