MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / Health

Function Health

vips/vips.go:99–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97}
98
99func Health() error {
100 timer := time.NewTimer(5 * time.Second)
101 defer timer.Stop()
102
103 done := make(chan struct{})
104
105 var err error
106
107 go func(done chan struct{}) {
108 runtime.LockOSThread()
109 defer runtime.UnlockOSThread()
110
111 defer Cleanup()
112
113 if C.vips_health() != 0 {
114 err = Error()
115 }
116
117 close(done)
118 }(done)
119
120 select {
121 case <-done:
122 return err
123 case <-timer.C:
124 return context.DeadlineExceeded
125 }
126}
127
128func Cleanup() {
129 C.vips_cleanup()

Callers 1

ExecuteMethod · 0.92

Calls 3

CleanupFunction · 0.85
ErrorFunction · 0.70
StopMethod · 0.65

Tested by

no test coverage detected