waitforit

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2018 License: MIT Imports: 8 Imported by: 0

README

Wait for a server is ready

func waitForSocket(scheme, addr string, timeout time.Duration) {
	wg.Add(1)
	go func() {
		defer wg.Done()
		for {
			conn, err := net.DialTimeout(scheme, addr, waitTimeoutFlag)
			if err != nil {
				log.Printf("Problem with dial: %v. Sleeping %s\n", err.Error(), waitRetryInterval)
				time.Sleep(waitRetryInterval)
			}
			if conn != nil {
				log.Printf("Connected to %s://%s\n", scheme, addr)
				return
			}
		}
	}()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultTransport

func NewDefaultTransport() *http.Transport

NewDefaultTransport is copied from net/http/transport.go

func WaitSocket

func WaitSocket(u url.URL, timeout time.Duration) (time.Duration, error)

func WaitSockets

func WaitSockets(ctx context.Context, us []url.URL, totalTimeout time.Duration, timeout time.Duration, retry int) (time.Duration, error)

Types

This section is empty.

Directories

Path Synopsis
cmd
waitforit command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL