don't overflow the server

This commit is contained in:
Shautvast 2026-04-03 20:19:04 +02:00
parent ea1a4a4a31
commit 05e9a9b688
2 changed files with 6 additions and 2 deletions

View file

@ -69,8 +69,11 @@ pub async fn get_tile(
// Fetch from Martin // Fetch from Martin
let (data, etag): (Bytes, Option<String>) = martin.get_tile(&layer, z, x, y).await?; let (data, etag): (Bytes, Option<String>) = martin.get_tile(&layer, z, x, y).await?;
// Store in cache (fire-and-forget) // Store in cache — spawn so the client doesn't wait for the Redis write.
cache.set_tile(&cache_key, &data).await; let cache2 = cache.clone();
let key2 = cache_key.clone();
let data2 = data.clone();
tokio::spawn(async move { cache2.set_tile(&key2, &data2).await });
let mut resp = HttpResponse::Ok(); let mut resp = HttpResponse::Ok();
resp.content_type("application/x-protobuf") resp.content_type("application/x-protobuf")

View file

@ -75,6 +75,7 @@ class _MapScreenState extends ConsumerState<MapScreen> {
data: (style) => VectorTileLayer( data: (style) => VectorTileLayer(
tileProviders: style.providers, tileProviders: style.providers,
theme: style.theme, theme: style.theme,
concurrency: 4,
), ),
loading: () => const SizedBox.shrink(), loading: () => const SizedBox.shrink(),
error: (e, _) => const SizedBox.shrink(), error: (e, _) => const SizedBox.shrink(),