-
Notifications
You must be signed in to change notification settings - Fork 20
Replace github.com/tim-ywliu/event dependency with standard GO library #260
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
Conversation
Signed-off-by: Arrobo, Gabriel <[email protected]>
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.
Pull Request Overview
This PR replaces the external github.com/tim-ywliu/event
dependency with a custom implementation using standard Go libraries. The change implements a custom event dispatcher system to handle SM policy notifications without relying on third-party dependencies.
- Replaced external event library with custom Go implementation
- Added event handler interface and dispatcher with thread-safe operations
- Enhanced error handling and logging for event processing
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
internal/notifyevent/dispatcher.go | Implements new custom event dispatcher with handlers and thread-safe operations |
internal/notifyevent/listener.go | Updates listener to implement new EventHandler interface with improved error handling |
internal/notifyevent/send_smpolicy_update.go | Removes external dependency, adds HandleEvent method and constructor function |
internal/notifyevent/send_smpolicy_termination.go | Removes external dependency, adds HandleEvent method and constructor function |
go.mod | Removes the external event dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
func (e SendSMpolicyUpdateNotifyEvent) HandleEvent(eventName string, data any) error { | ||
// This method is called by the dispatcher | ||
e.Handle() | ||
return nil | ||
} |
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.
The HandleEvent method ignores the eventName and data parameters but receives the event data through the receiver. This creates confusion about which data source should be used. Consider using the data parameter to maintain consistency with the interface design, or document why the receiver data takes precedence.
Copilot uses AI. Check for mistakes.
func (e SendSMpolicyTerminationNotifyEvent) HandleEvent(eventName string, data any) error { | ||
// This method is called by the dispatcher | ||
e.Handle() | ||
return nil | ||
} |
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.
The HandleEvent method ignores the eventName and data parameters but receives the event data through the receiver. This creates confusion about which data source should be used. Consider using the data parameter to maintain consistency with the interface design, or document why the receiver data takes precedence.
Copilot uses AI. Check for mistakes.
Signed-off-by: Arrobo, Gabriel <[email protected]>
No description provided.