-
Notifications
You must be signed in to change notification settings - Fork 60
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
Optimization of fetcher with notifiers #733
base: main
Are you sure you want to change the base?
Conversation
func NewFetcherProvider(dbManager *tokendb.Manager, notifierManager *tokendb.NotifierManager, metricsProvider metrics.Provider, strategy FetcherStrategy) *fetcherProvider { | ||
fetcher, ok := fetchers[strategy] | ||
if !ok { | ||
panic("undefined fetcher strategy: " + strategy) |
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.
why not returning an error here?
if err := tokenNotifier.Subscribe(func(operation driver3.Operation, m map[driver3.ColumnKey]string) { | ||
logger.Warnf("New operation %v: [%v]", operation, m) | ||
}); err != nil { | ||
panic(err) |
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.
why not returning an error here, so the code can resort to another strategy?
token/sdk/dig/sdk.go
Outdated
p.Container().Provide(identitydriver.NewDriver, dig.Group("identitydb-drivers")), | ||
p.Container().Provide(NewDBDrivers), | ||
p.Container().Provide(func(dbManager *tokendb.Manager, notifierManager *tokendb.NotifierManager, metricsProvider metrics.Provider) sherdlock.FetcherProvider { | ||
return sherdlock.NewFetcherProvider(dbManager, notifierManager, metricsProvider, sherdlock.Mixed) |
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.
show be the strategy configurable?
token/services/db/driverholder.go
Outdated
@@ -28,13 +28,13 @@ type serviceProvider interface { | |||
GetService(v interface{}) (interface{}, error) | |||
} | |||
|
|||
type dbDriver[D any] interface { | |||
type DBDriver[D any] interface { |
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.
just Driver given that the package's name is db
Signed-off-by: Alexandros Filios <[email protected]>
4cce636
to
5a9c229
Compare
No description provided.