revid: remove Burst method's duration parameter

This commit is contained in:
Scott 2020-01-31 14:31:17 +10:30
parent 054f0a5e77
commit 5502eea661
2 changed files with 5 additions and 4 deletions

View File

@ -198,8 +198,7 @@ func run(rv *revid.Revid, ns *netsender.Sender, l *logger.Logger, nl *netlogger.
continue continue
} }
case modeBurst: case modeBurst:
dur := time.Duration(rv.Config().BurstPeriod) * time.Second err = rv.Burst()
err = rv.Burst(dur)
if err != nil { if err != nil {
l.Log(logger.Warning, pkg+"could not start burst", "error", err.Error()) l.Log(logger.Warning, pkg+"could not start burst", "error", err.Error())
ns.SetMode(modePaused, &vs) ns.SetMode(modePaused, &vs)

View File

@ -493,7 +493,7 @@ func (r *Revid) Stop() {
} }
// Burst starts revid, waits for time specified, and then stops revid. // Burst starts revid, waits for time specified, and then stops revid.
func (r *Revid) Burst(duration time.Duration) error { func (r *Revid) Burst() error {
r.cfg.Logger.Log(logger.Info, pkg+"starting burst") r.cfg.Logger.Log(logger.Info, pkg+"starting burst")
err := r.Start() err := r.Start()
@ -501,7 +501,9 @@ func (r *Revid) Burst(duration time.Duration) error {
return fmt.Errorf("could not start revid: %w", err) return fmt.Errorf("could not start revid: %w", err)
} }
time.Sleep(duration) dur := time.Duration(r.cfg.BurstPeriod) * time.Second
time.Sleep(dur)
r.cfg.Logger.Log(logger.Info, pkg+"stopping burst") r.cfg.Logger.Log(logger.Info, pkg+"stopping burst")
r.Stop() r.Stop()
return nil return nil