()
| 156 | } |
| 157 | |
| 158 | func (a *App) idleMonitor() error { |
| 159 | ticker := time.NewTicker(10 * time.Second) |
| 160 | defer ticker.Stop() |
| 161 | |
| 162 | for { |
| 163 | select { |
| 164 | case <-ticker.C: |
| 165 | if a.pool.maybeIdle(a) { |
| 166 | a.Kill("app is idle") |
| 167 | return nil |
| 168 | } |
| 169 | case <-a.t.Dying(): |
| 170 | return nil |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | func (a *App) restartMonitor() error { |
| 176 | tmpDir := filepath.Join(a.dir, "tmp") |