* The supplement timer should only run when the radio is primary — it exists * to keep landing aircraft alive when local ADS-B drops them. When the API is * itself the primary source, `tick()` already polls it, so a second timer just * doubles the request rate into airplanes.live's rate lim
()
| 202 | * disappearing and reappearing" in #15). Reconcile it against the live source. |
| 203 | */ |
| 204 | private syncApiTimer(): void { |
| 205 | const want = this.o.source === "radio" && this.o.supplementApi; |
| 206 | if (want && !this.apiTimer && this.timer) { |
| 207 | void this.refreshApi(); |
| 208 | this.apiTimer = setInterval(() => void this.refreshApi(), this.o.apiPollMs); |
| 209 | } else if (!want && this.apiTimer) { |
| 210 | clearInterval(this.apiTimer); |
| 211 | this.apiTimer = null; |
| 212 | this.lastApi = []; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | private async fetchList(source: DataSource, now: number): Promise<Aircraft[] | null> { |
| 217 | const url = source === "radio" ? this.o.getConfig().radioUrl : this.buildApiUrl(); |
no test coverage detected