mirror of
https://github.com/Icinga/icingadb.git
synced 2026-06-09 00:42:37 -04:00
DB#Delete(): allow monitoring succeeded items
This commit is contained in:
parent
cc352252ec
commit
48b7bb4c35
1 changed files with 5 additions and 2 deletions
|
|
@ -582,14 +582,17 @@ func (db *DB) DeleteStreamed(
|
|||
|
||||
// Delete creates a channel from the specified ids and
|
||||
// bulk deletes them by passing the channel along with the entityType to DeleteStreamed.
|
||||
func (db *DB) Delete(ctx context.Context, entityType contracts.Entity, ids []interface{}) error {
|
||||
// IDs for which the query ran successfully will be passed to onSuccess.
|
||||
func (db *DB) Delete(
|
||||
ctx context.Context, entityType contracts.Entity, ids []interface{}, onSuccess ...OnSuccess[any],
|
||||
) error {
|
||||
idsCh := make(chan interface{}, len(ids))
|
||||
for _, id := range ids {
|
||||
idsCh <- id
|
||||
}
|
||||
close(idsCh)
|
||||
|
||||
return db.DeleteStreamed(ctx, entityType, idsCh)
|
||||
return db.DeleteStreamed(ctx, entityType, idsCh, onSuccess...)
|
||||
}
|
||||
|
||||
func (db *DB) GetSemaphoreForTable(table string) *semaphore.Weighted {
|
||||
|
|
|
|||
Loading…
Reference in a new issue