pbacsko commented on code in PR #752:
URL: https://github.com/apache/yunikorn-core/pull/752#discussion_r1420910260
##########
pkg/common/security/usergroup.go:
##########
@@ -40,7 +41,8 @@ const (
// global variables
var now time.Time // One clock to access
var instance *UserGroupCache // The instance of the cache
-var once sync.Once // Make sure we can only create the cache once
+var once = &sync.Once{} // Make sure we can only create the cache once
+var stopped atomic.Bool // whether UserGroupCache is stopped (needed for
multiple partitions)
// Cache for the user entries.
type UserGroupCache struct {
Review Comment:
Note: retrieving the instance can be refactored. I suggest moving away from
the singleton based getter, because only `initialPartitionFromConfig()` calls
it. Once it's rewritten, stop code becomes simpler. The only drawback is that
we'll have "n" cleaner goroutine for "n" partitions, but I think we can live
with that if the result is less state and simplicity.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]