Repository navigation
flyitalyadsb: --api-update-every, a faster API without writing the json files more often - #7
Merged
Merged
Conversation
…on files more often The map (tar1090 with --tar1090-use-api) can only be as fresh as the API buffer, which apiUpdate rebuilds every --write-json-every. Lowering that also rewrites aircraft.json and the globe tiles more often: on map.flyitalyadsb.com ~8.4 MiB per round, 4.2 MiB/s at 2 s, while the API update itself costs ~0.04 core at 2 s (stats.json, 2026-11-02). --api-update-every <sec> sets the API update interval on its own: - apiUpdateEntryPoint waits api_interval; - apiUpdate wakes the json writers once per json interval only, so the files keep --write-json-every (equal intervals: every update, as upstream); - with --tar1090-use-api, receiver.json "refresh" advertises the API rate, which is what the map polls; - the WITH_UUIDS recent-receivers window follows the update interval. Default: the write-json-every value; longer than that is clamped with a warning, because the API update is what wakes the json writers. flyitalyadsb/test-api-update-every.sh runs a real binary (flyitalyadsb-test.yaml): 0.5/2 s gives ~12 API updates and ~3 aircraft.json writes in 6 s and refresh 500; without the option both stay at 2 s (refresh 2000); 5 > 2 is clamped and warns. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The first version counted distinct values in 60 samples and assumed 6 s, but curl + python make the loop ~10 s, so it saw 17 API updates and 5 file writes and failed a correct binary. Now it samples for 8 s of wall clock and takes the median gap between readsb's own timestamps: 0.50 s API / 2.00 s aircraft.json with --api-update-every 0.5, 2.00/2.00 without (ubuntu 24.04 container). With the json-wake gate removed it reports aircraft.json every 0.50 s and fails. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why. map.flyitalyadsb.com moves every 2 s at best (every 3–4.5 s over London, a user's screen recording on 2026-11-02, fixed separately in flyitalyadsb/tar1090#5). The map reads the readsb API (
--tar1090-use-api), andapiUpdaterebuilds the API buffer every--write-json-every. Lowering that also rewrites aircraft.json and the 577 globe files every round: ~8.4 MiB, 4.2 MiB/s per cell today at 2 s, on a VM disk already writing ~25 MiB/s. The API update alone is cheap:api_update≈ 0.04 core at 2 s (stats.json last15min).Change:
--api-update-every <sec>apiUpdateEntryPointwaitsapi_intervalinstead ofjson_interval.apiUpdatewakes the json writers (Threads.json,Threads.globeJson) once per json interval only, so the files keep--write-json-every. With equal intervals it wakes on every update, as upstream.--tar1090-use-api, receiver.jsonrefreshis the API rate, which is what tar1090 polls (RefreshInterval = data.refresh).--write-json-every. Longer is clamped with a warning, since the API update is what wakes the writers.Readers of the double buffer (API workers, the two json writers) copy from the flipped buffer in milliseconds. A flip every 0.5 s gives them the same margin upstream gives at
--write-json-every 0.5.Test.
flyitalyadsb/test-api-update-every.shon a real binary, in a new workflowflyitalyadsb-test.yaml. It samples the API'snowand aircraft.json'snowfor 8 s and takes the median gap between readsb's own timestamps:--api-update-every 5with 2: refresh 2000 and the warning.Run locally, because CI can't run here: ubuntu:24.04 container,
make(gcc,-Werror) + upstreammake test+ the new test:Negative check: with the json-wake gate removed (
if (1 || …)) it fails withaircraft.json written every 0.50 s, expected 2.gh workflow run→ HTTP 422 "Actions has been disabled for this repository", whileactions/permissionssays enabled). No run since 2026-10-29 11:52Z: no sync-upstream, no promote, no PR builds. Until it's re-enabled, merging this builds no canary.Rollout. Merge →
readsb-canary:canaryon cell B. The option goes into nesso-infra's args only once cell A runs a stable that knows it, because an unknown option stops readsb. B first throughgen_cell_b.pyoverrides, then both.