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

Use icinga go library #163

Merged
merged 4 commits into from
Jan 16, 2025
Merged

Use icinga go library #163

merged 4 commits into from
Jan 16, 2025

Conversation

jrauh01
Copy link
Collaborator

@jrauh01 jrauh01 commented Jan 15, 2025

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.

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'
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Jan 15, 2025
@@ -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)
Copy link
Member

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()
}

return func(f *Features) {
f.onSuccess = fn
}
}

type ProcessBulk[T any] func(ctx context.Context, bulk []T) (err error)
Copy link
Member

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?

@jrauh01 jrauh01 requested a review from lippserd January 16, 2025 07:18
@lippserd lippserd merged commit f5e8867 into main Jan 16, 2025
7 checks passed
@lippserd lippserd deleted the use-icinga-go-library branch January 16, 2025 18:55
@lippserd lippserd added this to the 0.3.0 milestone Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants