mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 11:24:00 +00:00
fix(tomtom): size the daily tile budget to the real free allowance
TOMTOM_DAILY_TILE_BUDGET defaulted to 40,000 per day against a free tier that is granted per MONTH, not per day. TomTom currently allows 200,000 Traffic Flow & Incidents tile requests per month (https://docs.tomtom.com/pricing/), so the default exhausted a user's entire monthly allowance in five days and left the traffic layer dead for the rest of the billing period. The docs contradicted themselves on this. traffic.js described the free tier as "~50k/day", while .env.example cited the correct 200K per month two lines below quoting the same 40,000 default. 50k/day would be 1.5M/month, 7.5x the actual allowance. Sets the default to 6,000/day. A 31-day month lands at 186,000, inside the allowance with headroom. Corrects the stale figures in traffic.js, .env.example and DATA_SOURCES.md. This remains an application-side safety ceiling, not a billing cap, and the surrounding text still says so. TomTom's free tier requires no card, so overrunning it cuts the layer off rather than generating a charge — but a layer that dies three weeks into every month is still worth avoiding by default. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
0d41b6be54
commit
5e99adc978
5 files changed
+31
-12
No files matched your search
@@ -23,9 +23,16 @@ import {
|
||||
* Budget governor (mirrors the OpenSky credit-governor philosophy — last-good
|
||||
* data beats a dead layer): a persistent counter (.gev-cache/tomtom/budget.json,
|
||||
* keyed by UTC date, reset on day change) counts upstream fetch attempts
|
||||
* against a soft cap (TOMTOM_DAILY_TILE_BUDGET, default 40,000 of the free
|
||||
* tier's ~50k/day). Over the cap the proxy serves stale tiles when available,
|
||||
* else 429 {error:'budget'}.
|
||||
* against a soft cap (TOMTOM_DAILY_TILE_BUDGET). Over the cap the proxy
|
||||
* serves stale tiles when available, else 429 {error:'budget'}.
|
||||
*
|
||||
* The default is derived from TomTom's published free allowance, which is
|
||||
* granted MONTHLY, not daily: 200,000 Traffic Flow & Incidents tile requests
|
||||
* per month (https://docs.tomtom.com/pricing/). The previous 40,000/day
|
||||
* default — and the "~50k/day" figure this comment used to cite — exhausted
|
||||
* a month's entire allowance in five days, leaving the traffic layer dead
|
||||
* for the rest of the billing period. 6,000/day keeps a full 31-day month
|
||||
* inside the allowance (186,000) with headroom to spare.
|
||||
*
|
||||
* GET /api/tomtom/status → {hasKey, dailyCount, budget, date}. Keyless mode:
|
||||
* status reports hasKey:false and the tile endpoint 503s {error:'no_key'}
|
||||
@@ -37,7 +44,8 @@ export function tomtomProxy() {
|
||||
const TILE_TTL_MS = 120_000;
|
||||
const CACHE_DIR = path.join(process.cwd(), '.gev-cache', 'tomtom');
|
||||
const BUDGET_PATH = path.join(CACHE_DIR, 'budget.json');
|
||||
const DEFAULT_DAILY_BUDGET = 40000;
|
||||
// 200,000/month free tier / 31 days = 6,451. Rounded down for headroom.
|
||||
const DEFAULT_DAILY_BUDGET = 6000;
|
||||
const MEM_MAX_ENTRIES = 256;
|
||||
const UPSTREAM_TIMEOUT_MS = 15000;
|
||||
|
||||
|
||||
Reference in new issue
Block a user