cmd/rv/main.go: moved initialisation of revid to above run call

This commit is contained in:
Saxon 2020-01-28 10:49:42 +10:30
parent 10a8c70e6d
commit 86f804cf53
1 changed files with 5 additions and 10 deletions

View File

@ -118,6 +118,11 @@ func main() {
log.Log(logger.Fatal, pkg+"could not initialise netsender client: "+err.Error())
}
rv, err = revid.New(config.Config{Logger: log}, ns)
if err != nil {
log.Log(logger.Fatal, pkg+"could not initialise revid", "error", err.Error())
}
run(rv, ns, log, netLog)
}
@ -153,16 +158,6 @@ func run(rv *revid.Revid, ns *netsender.Sender, l *logger.Logger, nl *netlogger.
continue
}
// If first time running loop, i.e. rv == nil, then we create a new Revid.
if rv == nil {
rv, err = revid.New(config.Config{Logger: l}, ns)
if err != nil {
l.Log(logger.Warning, pkg+"could not initialise revid", "error", err.Error())
sleep(ns, l)
continue
}
}
// Configure revid based on the vars.
err = rv.Update(vars)
if err != nil {