From aed08107bc8a3948cc2180dbe4f87c62a823a37c Mon Sep 17 00:00:00 2001 From: Aurora Luna Takemi <98479040+auroraisluna@users.noreply.github.com> Date: Fri, 24 Nov 2023 09:33:17 +0200 Subject: [PATCH] fix(hoppie): Updated Hoppie Poll rate (#8283) * Update HoppieConnector.ts * Update timings * fix lint * Update fbw-common/src/systems/datalink/router/src/webinterfaces/HoppieConnector.ts Co-authored-by: Michael Corcoran * Update fbw-common/src/systems/datalink/router/src/webinterfaces/HoppieConnector.ts Co-authored-by: Michael Corcoran --------- Co-authored-by: Michael Corcoran --- .../datalink/router/src/webinterfaces/HoppieConnector.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fbw-common/src/systems/datalink/router/src/webinterfaces/HoppieConnector.ts b/fbw-common/src/systems/datalink/router/src/webinterfaces/HoppieConnector.ts index 50f9f7d3c95..03f200d990e 100644 --- a/fbw-common/src/systems/datalink/router/src/webinterfaces/HoppieConnector.ts +++ b/fbw-common/src/systems/datalink/router/src/webinterfaces/HoppieConnector.ts @@ -375,7 +375,13 @@ export class HoppieConnector { } } + /** + * Gets the interval to poll the Hoppie API in milliseconds. + * Warning: This will return a different random time on each invocation! + * @returns The polling interval in milliseconds. + */ public static pollInterval(): number { - return 5000; + // To comply with Hoppie rate limits, we choose a random number between 45 and 75, as recommend by Hoppie. Ref to: https://www.hoppie.nl/acars/system/tech.html + return Math.random() * 30_000 + 45_000; } }