blob: 5136287cf30ec5ad0951c030e16924c7cff9ec60 [file] [log] [blame]
Giorgi Lekveishvili378ea882023-12-12 13:59:18 +04001package tasks
2
3import (
4 "fmt"
5 "net/http"
6 "time"
7)
8
9func waitForAddr(addr string) Task {
10 t := newLeafTask(fmt.Sprintf("Wait for %s to come up", addr), func() error {
11 for {
12 if resp, err := http.Get(addr); err != nil || resp.StatusCode != http.StatusOK {
13 time.Sleep(2 * time.Second)
14 } else {
15 return nil
16 }
17 }
18 })
19 return &t
20}