fix(pkg/daemon): turn on red rgb-led if something goes wrong in other cases

This commit is contained in:
Markus Pesch 2019-06-21 14:37:02 +02:00
parent afd7accb47
commit f979e88a52
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -51,8 +51,15 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
for { for {
select { select {
case err, _ := <-errorChannel: case err, _ := <-errorChannel:
err = rgbled.Red(rgbLEDs)
if err != nil {
logger.Error("Can not turn on red info light: %v", err)
}
logger.Error("%v", err) logger.Error("%v", err)
time.Sleep(time.Second * 2)
case <-ticker: case <-ticker:
err := rgbled.Blue(rgbLEDs) err := rgbled.Blue(rgbLEDs)
if err != nil { if err != nil {
@ -63,6 +70,12 @@ func Start(cnf *config.Configuration, cleanCacheInterval time.Duration, compress
err = logfile.AppendTemperatures(temperatureLogfile, compression, temperatureCache) err = logfile.AppendTemperatures(temperatureLogfile, compression, temperatureCache)
if err != nil { if err != nil {
err = rgbled.Red(rgbLEDs)
if err != nil {
logger.Error("Can not turn on red info light: %v", err)
}
cancel() cancel()
logger.Fatal("Can not save temperatures: %v", err) logger.Fatal("Can not save temperatures: %v", err)
} }