Skip to content

Commit 7214b28

Browse files
authored
Merge pull request #797 from Icinga/structifyStream-iochan
Make structifyStream() channel types more explicit, e.g. input only
2 parents 3484476 + a3ed042 commit 7214b28

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

pkg/icingadb/runtime_updates.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,17 +301,24 @@ func (r *RuntimeUpdates) xRead(ctx context.Context, updateMessagesByKey map[stri
301301
// those messages into Icinga DB entities (contracts.Entity) using the provided structifier.
302302
// Converted entities are inserted into the upsertEntities or deleteIds channel depending on the "runtime_type" message field.
303303
func structifyStream(
304-
ctx context.Context, updateMessages <-chan redis.XMessage, upsertEntities, upserted chan database.Entity,
305-
deleteIds, deleted chan interface{}, structifier structify.MapStructifier,
304+
ctx context.Context,
305+
updateMessages <-chan redis.XMessage,
306+
upsertEntities chan<- database.Entity,
307+
upserted <-chan database.Entity,
308+
deleteIds chan<- any,
309+
deleted <-chan any,
310+
structifier structify.MapStructifier,
306311
) func() error {
307312
if upserted == nil {
308-
upserted = make(chan database.Entity)
309-
close(upserted)
313+
ch := make(chan database.Entity)
314+
close(ch)
315+
upserted = ch
310316
}
311317

312318
if deleted == nil {
313-
deleted = make(chan interface{})
314-
close(deleted)
319+
ch := make(chan any)
320+
close(ch)
321+
deleted = ch
315322
}
316323

317324
return func() error {

0 commit comments

Comments
 (0)