(idleTime time.Duration)
| 78 | } |
| 79 | |
| 80 | func cleanPeriod(idleTime time.Duration) time.Duration { |
| 81 | period := idleTime / 2 |
| 82 | if period <= 0 { |
| 83 | period = time.Millisecond |
| 84 | } |
| 85 | if period > time.Minute { |
| 86 | period = time.Minute |
| 87 | } |
| 88 | return period |
| 89 | } |
| 90 | |
| 91 | func (p *VMPool) Get(ctx context.Context) (*VM, error) { |
| 92 | for { |