Skip to content

Commit

Permalink
add sleep
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Davis <[email protected]>
  • Loading branch information
Doug Davis committed May 10, 2021
1 parent ab91f16 commit 93d1bb8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions helloworld/helloworld.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ func main() {
// Otherwise we're an App and we need to start the HTTP server
// to processing incoming requests
if jobIndex := os.Getenv("JOB_INDEX"); jobIndex != "" {
sleep := os.Getenv("SLEEP")
if sleep != "" {
len, _ := strconv.Atoi(sleep)
if len > 0 {
Debug(false, "Sleeping %d", len)
time.Sleep(time.Duration(len) * time.Second)
}
}

fmt.Printf("Hello from helloworld! I'm a batch job! Index: %s\n\n",
jobIndex)
PrintMessage(os.Stdout)
Expand Down

0 comments on commit 93d1bb8

Please sign in to comment.