From 10908a17494d9f4d04f29eba6679045b3500d8c7 Mon Sep 17 00:00:00 2001 From: Saxon Nelson-Milton Date: Fri, 10 Apr 2020 17:33:24 +0100 Subject: [PATCH] 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. --- cmd/rv/main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/rv/main.go b/cmd/rv/main.go index a3b60d3a..53d145f7 100644 --- a/cmd/rv/main.go +++ b/cmd/rv/main.go @@ -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. @@ -145,6 +146,12 @@ func main() { if err != nil { 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)