MCPcopy Create free account
hub / github.com/SignTools/SignTools / WaitForServer

Function WaitForServer

src/util/util.go:52–66  ·  view source on GitHub ↗
(url string, timeout time.Duration)

Source from the content-addressed store, hash-verified

50}
51
52func WaitForServer(url string, timeout time.Duration) error {
53 ctx, cancelFunc := context.WithTimeout(context.Background(), timeout)
54 defer cancelFunc()
55 for {
56 select {
57 case <-ctx.Done():
58 return errors.New("reach server timed out: " + url)
59 default:
60 if _, err := http.Get(url); err == nil {
61 return nil
62 }
63 time.Sleep(100 * time.Millisecond)
64 }
65 }
66}
67
68// Just like os.ReadDir but ignores hidden files starting with '.' such as macOS '.DS_Store'.
69func RemoveHiddenDirs(dirs []os.DirEntry) []os.DirEntry {

Callers 3

TestMainFunction · 0.92
getPublicUrlMethod · 0.92
getPublicUrlMethod · 0.92

Calls 2

NewMethod · 0.80
GetMethod · 0.45

Tested by 1

TestMainFunction · 0.74