Skip to content

Commit

Permalink
add short-cycle buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulexus committed Jan 14, 2021
1 parent 63828c2 commit 7ff7a1d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"os"
"time"

"github.com/CyCoreSystems/ipassign/internal/annotation"
"github.com/CyCoreSystems/ipassign/internal/constants"
Expand All @@ -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")
Expand Down Expand Up @@ -108,6 +111,10 @@ func main() {
} else {
log.Warnw("watch exited", "error", err)
}

if ctx.Err() == nil {
time.Sleep(watchLoopShortCycleBuffer)
}
}
os.Exit(1)
}
Expand Down

0 comments on commit 7ff7a1d

Please sign in to comment.