refactor: try to refactor the load config code to 2 clear pathes#814
Merged
jackchenjc merged 2 commits intoedgexfoundry:mainfrom Feb 2, 2025
Merged
refactor: try to refactor the load config code to 2 clear pathes#814jackchenjc merged 2 commits intoedgexfoundry:mainfrom
jackchenjc merged 2 commits intoedgexfoundry:mainfrom
Conversation
d3f9d8c to
f6565fc
Compare
jackchenjc
requested changes
Jan 27, 2025
Contributor
jackchenjc
left a comment
There was a problem hiding this comment.
Hi @qs-wang,
Thanks for the refactoring. I've left a comment below about a minor detail I noticed.
jackchenjc
reviewed
Jan 27, 2025
6a77bba to
91d412a
Compare
…th clearly - split loadConfigByProvider to a separate method to make if/else statemtn clearer - split loadPrivateConfigFromFile to a separate method for reuse in if/else branches Signed-off-by: Q.s <wangqs_eclipse@yahoo.com>
91d412a to
7123958
Compare
|
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #814 +/- ##
==========================================
- Coverage 46.51% 46.20% -0.31%
==========================================
Files 62 62
Lines 3603 3627 +24
==========================================
Hits 1676 1676
- Misses 1805 1829 +24
Partials 122 122 ☔ View full report in Codecov by Sentry. |
7123958 to
989def7
Compare
Signed-off-by: Q.s <wangqs_eclipse@yahoo.com>
989def7 to
f4834ce
Compare
judehung
added a commit
to judehung/go-mod-bootstrap
that referenced
this pull request
Jun 13, 2025
fixes edgexfoundry#872 The send on close channel panic are occasionally observed when a service is terminated. The root cause is that go-mod-bootstrap implements listensForChanges by creating sender channel in the side of receiver, and close the sender channel in the side of receiver will cause the panic. The simplest solution with least code refactor is to not defer close(updateStream) and defer close(errorStream) in listenForPrivateChanges, listenForCommonChanges, and ListenForCustomChanges since there is no need to close the channels. Moreover, edgexfoundry#814 accidentally adds reduandant calls to listen for changes on Writable. As the `cp.loadConfigByProvider` will listen for changes on Writable at https://github.com/edgexfoundry/go-mod-bootstrap/pull/814/files#diff-5346c73553fe1e8350deb1a29ed066b1202c1ea35e57d206adbb6f359ed1d299R332-R343, there is no need to do it again at https://github.com/edgexfoundry/go-mod-bootstrap/pull/814/files#diff-5346c73553fe1e8350deb1a29ed066b1202c1ea35e57d206adbb6f359ed1d299R181-R192. This fix also removes this redundant calls. Signed-off-by: Jude Hung <jude@iotechsys.com>
judehung
added a commit
to judehung/go-mod-bootstrap
that referenced
this pull request
Jun 13, 2025
fixes edgexfoundry#872 The send on close channel panic are occasionally observed when a service is terminated. The root cause is that go-mod-bootstrap implements listensForChanges by creating sender channel in the side of receiver, and close the sender channel in the side of receiver will cause the panic. The simplest solution with least code refactor is to not defer close(updateStream) and defer close(errorStream) in listenForPrivateChanges, listenForCommonChanges, and ListenForCustomChanges since there is no need to close the channels. Moreover, edgexfoundry#814 accidentally adds reduandant calls to listen for changes on Writable. As the `cp.loadConfigByProvider` will listen for changes on Writable at https://github.com/edgexfoundry/go-mod-bootstrap/pull/814/files#diff-5346c73553fe1e8350deb1a29ed066b1202c1ea35e57d206adbb6f359ed1d299R332-R343, there is no need to do it again at https://github.com/edgexfoundry/go-mod-bootstrap/pull/814/files#diff-5346c73553fe1e8350deb1a29ed066b1202c1ea35e57d206adbb6f359ed1d299R181-R192. This fix also removes this redundant calls. Signed-off-by: Jude Hung <jude@iotechsys.com>
5 tasks
FelixTing
pushed a commit
to FelixTing/go-mod-bootstrap
that referenced
this pull request
Oct 14, 2025
fixes edgexfoundry#872 The send on close channel panic are occasionally observed when a service is terminated. The root cause is that go-mod-bootstrap implements listensForChanges by creating sender channel in the side of receiver, and close the sender channel in the side of receiver will cause the panic. The simplest solution with least code refactor is to not defer close(updateStream) and defer close(errorStream) in listenForPrivateChanges, listenForCommonChanges, and ListenForCustomChanges since there is no need to close the channels. Moreover, edgexfoundry#814 accidentally adds reduandant calls to listen for changes on Writable. As the `cp.loadConfigByProvider` will listen for changes on Writable at https://github.com/edgexfoundry/go-mod-bootstrap/pull/814/files#diff-5346c73553fe1e8350deb1a29ed066b1202c1ea35e57d206adbb6f359ed1d299R332-R343, there is no need to do it again at https://github.com/edgexfoundry/go-mod-bootstrap/pull/814/files#diff-5346c73553fe1e8350deb1a29ed066b1202c1ea35e57d206adbb6f359ed1d299R181-R192. This fix also removes this redundant calls. Signed-off-by: Jude Hung <jude@iotechsys.com>
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.
I tried to make some changes for my own purpose. While I read the code although the code works perfectly, it a little bit hard to understand and change because the config loading logic from the provider and file are mixed. I refactored it to split the loading logic , i.e. loading from provider and file, to 2 methods, which made my changes easier. Later on I found other solution so the changes got dropped, but I am trying to push the refactor to see if anyone is interested.
If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/go-mod-bootstrap/blob/main/.github/Contributing.md
PR Checklist
Please check if your PR fulfills the following requirements:
BREAKING CHANGE:describing the break)Testing Instructions
New Dependency Instructions (If applicable)