Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

alexandrosfilios
Copy link
Contributor

No description provided.

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)
Copy link
Contributor

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)
Copy link
Contributor

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?

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)
Copy link
Contributor

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?

@@ -28,13 +28,13 @@ type serviceProvider interface {
GetService(v interface{}) (interface{}, error)
}

type dbDriver[D any] interface {
type DBDriver[D any] interface {
Copy link
Contributor

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants