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 committed by Joe Stump
parent a59f2c1e4b
commit 99dbe34d0f
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

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