| 212 | private static wakeInterval: number = -1; |
| 213 | |
| 214 | private static runWakeDetector() { |
| 215 | const WAKE_CHECK_INTERVAL = getDuration({minutes: 1}); |
| 216 | const WAKE_CHECK_INTERVAL_ERROR = getDuration({seconds: 10}); |
| 217 | if (this.wakeInterval >= 0) { |
| 218 | clearInterval(this.wakeInterval); |
| 219 | } |
| 220 | |
| 221 | let lastRun = Date.now(); |
| 222 | this.wakeInterval = setInterval(() => { |
| 223 | const now = Date.now(); |
| 224 | if (now - lastRun > WAKE_CHECK_INTERVAL + WAKE_CHECK_INTERVAL_ERROR) { |
| 225 | Extension.handleAutomationCheck(); |
| 226 | } |
| 227 | lastRun = now; |
| 228 | }, WAKE_CHECK_INTERVAL); |
| 229 | } |
| 230 | |
| 231 | static async start(): Promise<void> { |
| 232 | Extension.init(); |