nolint
(f func(), exitDelay time.Duration)
| 194 | |
| 195 | //nolint |
| 196 | func waitFunc(f func(), exitDelay time.Duration) error { |
| 197 | funcDone := make(chan struct{}) |
| 198 | go func() { |
| 199 | defer close(funcDone) |
| 200 | f() |
| 201 | }() |
| 202 | |
| 203 | if exitDelay <= 0 { |
| 204 | <-funcDone |
| 205 | |
| 206 | return nil |
| 207 | } |
| 208 | |
| 209 | select { |
| 210 | case <-time.After(exitDelay): |
| 211 | return ErrTimeout |
| 212 | case <-funcDone: |
| 213 | } |
| 214 | |
| 215 | return nil |
| 216 | } |
| 217 | |
| 218 | var ( |
| 219 | ErrTimeout = errors.New(`TIMEOUT`) |
no outgoing calls
no test coverage detected