Support for concurrent spawn of services from multiple goroutines#59
Merged
pavelpatrin merged 6 commits intomainfrom Jun 10, 2025
Merged
Support for concurrent spawn of services from multiple goroutines#59pavelpatrin merged 6 commits intomainfrom
pavelpatrin merged 6 commits intomainfrom
Conversation
Signed-off-by: Pavel Patrin <[email protected]>
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for concurrent spawning of services from multiple goroutines and refactors factory and registry internal representations for improved thread-safety and clarity. Key changes include:
- Replacing direct factory initialization with a two-step process (creating a source and then generating the factory).
- Introducing thread-safe access in the factory’s internal fields via new mutex-protected getters and setters.
- Updating test cases to accommodate renaming of fields and to test concurrent resolution of services.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| registry_test.go | Updates tests to use the new factory creation pattern and introduces concurrent spawn test improvements. |
| registry.go | Refactors factory handling with thread-safety enhancements and renames field accesses. |
| factory_test.go | Adjusts test validations to reflect the new internal representation of factories. |
| factory.go | Renames and refactors factory internals, including updated metadata and thread-safe methods. |
| container.go | Registers factories using the updated pattern and adjusts service retrieval accordingly. |
Comments suppressed due to low confidence (1)
factory.go:320
- The comment above this function duplicates that of getOutValues; please update it to clearly indicate that this function sets the factory output values in a thread-safe way.
func (f *factory) setOutValues(values []reflect.Value) {
Signed-off-by: Pavel Patrin <[email protected]>
Signed-off-by: Pavel Patrin <[email protected]>
Signed-off-by: Pavel Patrin <[email protected]>
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.