MCPcopy
hub / github.com/jordan-wright/email / get

Method get

pool.go:80–108  ·  view source on GitHub ↗
(timeout time.Duration)

Source from the content-addressed store, hash-verified

78}
79
80func (p *Pool) get(timeout time.Duration) *client {
81 select {
82 case c := <-p.clients:
83 return c
84 default:
85 }
86
87 if p.created < p.max {
88 p.makeOne()
89 }
90
91 var deadline <-chan time.Time
92 if timeout >= 0 {
93 deadline = time.After(timeout)
94 }
95
96 for {
97 select {
98 case c := <-p.clients:
99 return c
100 case <-p.rebuild:
101 p.makeOne()
102 case <-deadline:
103 return nil
104 case <-p.closing:
105 return nil
106 }
107 }
108}
109
110func shouldReuse(err error) bool {
111 // certainly not perfect, but might be close:

Callers 1

SendMethod · 0.95

Calls 1

makeOneMethod · 0.95

Tested by

no test coverage detected