1// Copyright (C) 2020 Storj Labs, Inc. 2// See LICENSE for copying information. 3 4// +build unittest !windows 5 6package main 7 8import ( 9 "context" 10 11 "go.uber.org/zap" 12 13 "storj.io/storj/private/version/checker" 14) 15 16// loopFunc is func that is run by the update cycle. 17func loopFunc(ctx context.Context) error { 18 zap.L().Info("Downloading versions.", zap.String("Server Address", runCfg.Version.ServerAddress)) 19 20 all, err := checker.New(runCfg.Version.ClientConfig).All(ctx) 21 if err != nil { 22 zap.L().Error("Error retrieving version info.", zap.Error(err)) 23 return nil 24 } 25 26 if err := update(ctx, runCfg.ServiceName, runCfg.BinaryLocation, all.Processes.Storagenode); err != nil { 27 // don't finish loop in case of error just wait for another execution 28 zap.L().Error("Error updating service.", zap.String("Service", runCfg.ServiceName), zap.Error(err)) 29 } 30 31 if err := update(ctx, updaterServiceName, updaterBinaryPath, all.Processes.StoragenodeUpdater); err != nil { 32 // don't finish loop in case of error just wait for another execution 33 zap.L().Error("Error updating service.", zap.String("Service", updaterServiceName), zap.Error(err)) 34 } 35 36 return nil 37} 38