cmd/rv/main.go: added delay before running stuff

We were getting problems with connection to RTSP device when revid was started from boot.
It seemed like system networking things were not given enough time to establish themselves
before we tried to use them. A delay before running revid fixes this, but is a bit of a
hacky solution. Better solution would be appreciated.
This commit is contained in:
Saxon Nelson-Milton 2020-04-10 17:33:24 +01:00
parent 4d5a85b853
commit 10908a1749
1 changed files with 7 additions and 0 deletions

View File

@ -102,6 +102,7 @@ const (
defaultSleepTime = 60 // Seconds
profilePath = "rv.prof"
pkg = "rv: "
runPreDelay = 20 * time.Second
)
// This is set to true if the 'profile' build tag is provided on build.
@ -146,6 +147,12 @@ func main() {
log.Log(logger.Fatal, pkg+"could not initialise revid", "error", err.Error())
}
// NB: Problems were encountered with communicating with RTSP inputs. When trying to
// connect it would fail due to timeout; as if things had not been set up quickly
// enough before revid tried to do things. This delay fixes this, but there is probably
// a better way to solve this problem.
time.Sleep(runPreDelay)
log.Log(logger.Debug, "beginning main loop")
run(rv, ns, log, netLog)
}