about summary refs log tree commit diff
path: root/main.go
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2019-12-03T09·44+0100
committerFlorian Klink <flokli@flokli.de>2019-12-03T09·44+0100
commit4ea1a5a2f006fa44f3e759929f366efa050025bf (patch)
tree5d7c9a14f1883242bb1962867ae47f64a9c9c386 /main.go
parent77fe8a8e1f46c3574502a91f62645533780de3bb (diff)
main.go: add --trigger-interval cli flag
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.go b/main.go
index 338be7865b9e..69d94c608230 100644
--- a/main.go
+++ b/main.go
@@ -23,6 +23,7 @@ import (
 func main() {
 	var URL, username, password, projectName, branchName, submitQueueTag string
 	var fetchOnly bool
+	var triggerInterval int
 
 	app := cli.NewApp()
 	app.Name = "gerrit-queue"
@@ -70,6 +71,13 @@ func main() {
 			Destination: &submitQueueTag,
 			Value:       "submit_me",
 		},
+		cli.IntFlag{
+			Name:        "trigger-interval",
+			Usage:       "How often we should trigger ourselves (interval in seconds)",
+			EnvVar:      "SUBMIT_QUEUE_TRIGGER_INTERVAL",
+			Destination: &triggerInterval,
+			Value:       600,
+		},
 		cli.BoolFlag{
 			Name:        "fetch-only",
 			Usage:       "Only fetch changes and assemble queue, but don't actually write",
@@ -104,7 +112,7 @@ func main() {
 		// ticker
 		go func() {
 			for {
-				time.Sleep(time.Minute * 5)
+				time.Sleep(time.Duration(triggerInterval) * time.Minute)
 				runner.Trigger(fetchOnly)
 			}
 		}()