-
Notifications
You must be signed in to change notification settings - Fork 2
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
Use icinga go library #163
Conversation
Replace module packages with accordingly imports from the icinga-go-library except the database package. That will be replaced later.
Local package 'database' -> 'kdatabase' Local db 'db' -> 'kdb' IGL package 'igldatabase' -> 'database' IGL db 'db2' -> 'db'
pkg/database/cleanup.go
Outdated
@@ -107,7 +107,7 @@ type cleanupWhere struct { | |||
} | |||
|
|||
func (db *Database) PeriodicCleanup(ctx context.Context, stmt CleanupStmt) error { | |||
g, ctxCleanup := errgroup.WithContext(ctx) | |||
g, _ := errgroup.WithContext(ctx) |
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.
Instead of unnecessarily creating an errgroup, we could simply do the following at the end of the function:
select {
case err := <-errs:
return err
case <-ctx.Done():
return ctx.Err()
}
pkg/database/features.go
Outdated
return func(f *Features) { | ||
f.onSuccess = fn | ||
} | ||
} | ||
|
||
type ProcessBulk[T any] func(ctx context.Context, bulk []T) (err error) |
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.
Can't all of this replaced with OnSuccessSendTo?
Replace module packages with accordingly imports from the icinga-go-library to reduce code redundancy. An exception is the database package that will be replaced later.