func New(countdown time.Duration, detonate func()) *TimeBomb { return &TimeBomb{ countdown: countdown, detonate: detonate, reset: make(chan bool), defuse: make(chan bool), cooldown: drain.New(), } }
func New( listenNetwork, listenAddr string, containerGraceTime time.Duration, backend warden.Backend, ) *WardenServer { return &WardenServer{ listenNetwork: listenNetwork, listenAddr: listenAddr, containerGraceTime: containerGraceTime, backend: backend, setStopping: make(chan bool), stopping: make(chan bool), openRequests: drain.New(), } }
package drain_test import ( "time" . "github.com/onsi/ginkgo" "github.com/cloudfoundry-incubator/garden/drain" ) var _ = Describe("Drain", func() { Describe(".Wait", func() { It("returns immediately", func(done Done) { drain := drain.New() drain.Wait() close(done) }, 1.0) }) Describe(".Incr", func() { Describe(".Wait", func() { It("blocks", func() { drain := drain.New() drain.Incr() waited := make(chan bool) go func() { drain.Wait() waited <- true }()