Use a Waiter diode, to avoid constant CPU usage. Fixes #777

This commit is contained in:
Deluan 2021-02-13 12:08:32 -05:00
parent 48847ae479
commit cfc9162729
1 changed files with 2 additions and 2 deletions

View File

@ -7,12 +7,12 @@ import (
)
type diode struct {
d *diodes.Poller
d *diodes.Waiter
}
func newDiode(ctx context.Context, size int, alerter diodes.Alerter) *diode {
return &diode{
d: diodes.NewPoller(diodes.NewOneToOne(size, alerter), diodes.WithPollingContext(ctx)),
d: diodes.NewWaiter(diodes.NewOneToOne(size, alerter), diodes.WithWaiterContext(ctx)),
}
}