fix(#404): cache-bust config fetches so a re-import never serves stale

raw.githubusercontent sits behind a CDN with a multi-minute TTL; a catalog edit
followed by a quick re-import returned the OLD profile (reported: a removed
region still showing as a change). Append a unique query param + no-cache
headers so every catalog/profile fetch is fresh.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pull/455/head
Strycher 4 months ago
parent 664f2675e5
commit edd2b7e177

@ -79,7 +79,22 @@ class ConfigSourceService {
Future<String> _get(String url) async {
final http.Response resp;
try {
resp = await _client.get(Uri.parse(url));
// Cache-bust: config fetches must never serve a stale catalog/profile
// (raw.githubusercontent sits behind a CDN with a multi-minute TTL, so a
// re-import right after a catalog edit could otherwise return the old
// file). A unique query param guarantees a cache miss; the no-cache
// headers are belt-and-braces.
final base = Uri.parse(url);
final busted = base.replace(
queryParameters: {
...base.queryParameters,
'_': DateTime.now().millisecondsSinceEpoch.toString(),
},
);
resp = await _client.get(
busted,
headers: const {'Cache-Control': 'no-cache', 'Pragma': 'no-cache'},
);
} catch (e) {
throw ConfigSourceException('Could not reach $url: $e');
}

Loading…
Cancel
Save

Powered by TurnKey Linux.