Comment

Comment by clnq

Exponential back-off is fancy. There are a million repeating behaviors in a large automotive codebase. Maybe it's too arduous to code up exponential back-off for all. Even if you have a simple library to do it, it could introduce some complexity.

But it's quite easy to set timers to attempt things at regular intervals, rather than in an infinite loop until they succeed.

One attempt every 5 seconds (assuming a 5-second timeout for the request) is 17,280 attempts a day. One attempt every 5 minutes is 288 attempts a day. One attempt every 15 minutes is 96 attempts a day.

A simple repeating timer is a fantastic solution.

Does the car need to always send telemetry immediately? Can there be a 15-minute latency? If so, just put that on a timer and enjoy 99.4% power savings for offline cars, with basically the same quality of telemetry when they're online.

But what if a car needs to send telemetry at a given moment? Just move up the next timer function call.

But what if I want to get telemetry when the 3G signal is intermittent and briefly available? Just call the function once the 3G signal is available. Do this with a separate cool-down for this behavior.

But what if I need telemetry every second? Just dump all telemetry events into a buffer between successful sends, slap a timestamp on those events, and you can now send data for the past X hours all at once. Even from the black spots.

There are so many options (even less fancy than exp back-off), but this was probably built by a junior programmer without any support network. This feels like a very common lack-of-experience mistake that would be caught in code review if the reviewer cared.

parent clnq 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton