diff --git a/main.go b/main.go index 86cff2b..3c57178 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "os" + "time" "github.com/CyCoreSystems/ipassign/internal/annotation" "github.com/CyCoreSystems/ipassign/internal/constants" @@ -32,6 +33,8 @@ var testMode bool var log *zap.SugaredLogger +var watchLoopShortCycleBuffer = 2 * time.Second + func init() { flag.BoolVar(&testMode, "test", false, "test mode will not update associations") flag.StringVar(&ipTagKey, "ipTagKey", "voice", "key name by which the potential Elastic IPs will be tagged") @@ -108,6 +111,10 @@ func main() { } else { log.Warnw("watch exited", "error", err) } + + if ctx.Err() == nil { + time.Sleep(watchLoopShortCycleBuffer) + } } os.Exit(1) }