-
Notifications
You must be signed in to change notification settings - Fork 6
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
Optimize pub/sub key management and session ID handling #682
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ed labels This change facilitates future caching of labels and keys. The update ensures that the session ID (UUID) is incorporated into all pubsub messages, enhancing traceability and debugging. Both the scheduler and imon components have been updated to handle session IDs consistently, and redundant 'sid' labels have been removed, as session IDs are now encapsulated in the dedicated session ID field.
…ache. This commit removes session ids from labels, to have cacheable label values. Don't anymore use published label with SessionID or RequesterSessionID. Labels have a cost, instead move it to Exec... structures so filter is still possible. This commit introduces the `RequesterSessionID` field to `Exec`, `ExecFailed`, and `ExecSuccess` message structures. So it is still possible to filter on data value.
Stop using pubsub.Bus, and prefer separate PublishBuilder and SubscribeBuilder. SubFromContext and PubFromContext return SubscribeBuilder and PublishBuilder. Publicator that implements PublishBuilder will handle the keys caching.
Replaced redundant functions and improved handling of pubKeys for publications. Added caching for derived keys using `sync.RWMutex` to enhance efficiency. This change simplifies and optimizes how publication keys are generated and accessed. Now each Publicator own a cache of publication filters
Extracted cmdPub construction logic into a new helper method `cmdPubFactory`, improving readability and separation of concerns. Adjusted the `Pub` method to handle channel communication cleanly and utilize the helper for creating `cmdPub` instances.
Replaced `Publicator` with direct use of `Bus` for publishing, removing unnecessary abstraction. Optimized label combination generation with a more efficient approach using `combinations` function. Simplified code and improved maintainability by eliminating redundant locking and factory methods. Refactor pubsub interfaces for clearer and unified naming Rename interfaces `PublishBuilder` and `SubscribeBuilder` with `Publisher` and `Subscriber`.
New extract:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces multiple improvements and optimizations for the
pubsub
,daemonapi
,imon
, andscheduler
components:pubsub
module has undergone significant refactoring to optimize key handling, including caching publication keys usingsync.RWMutex
. This enhances efficiency and reduces redundant operations.pubsub.Bus
with dedicatedPublishBuilder
andSubscribeBuilder
. This change simplifies context-based publication and subscription management.RequesterSessionID
field is now introduced for session-related message structures (Exec
,ExecFailed
,ExecSuccess
), ensuring consistent traceability while improving overall performance.pubsub
messages, ensuring they are managed systematically without relying on redundant labels for enhanced traceability and debugging.These changes collectively simplify the system, reduce computational overhead, and set the foundation for future caching and optimization enhancements.