diff --git a/backend/src/routes/tiles.rs b/backend/src/routes/tiles.rs index 1528696..7d51839 100644 --- a/backend/src/routes/tiles.rs +++ b/backend/src/routes/tiles.rs @@ -69,8 +69,11 @@ pub async fn get_tile( // Fetch from Martin let (data, etag): (Bytes, Option) = martin.get_tile(&layer, z, x, y).await?; - // Store in cache (fire-and-forget) - cache.set_tile(&cache_key, &data).await; + // Store in cache — spawn so the client doesn't wait for the Redis write. + 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(); resp.content_type("application/x-protobuf") diff --git a/mobile/lib/features/map/presentation/screens/map_screen.dart b/mobile/lib/features/map/presentation/screens/map_screen.dart index 1a6137a..8ce1053 100644 --- a/mobile/lib/features/map/presentation/screens/map_screen.dart +++ b/mobile/lib/features/map/presentation/screens/map_screen.dart @@ -75,6 +75,7 @@ class _MapScreenState extends ConsumerState { data: (style) => VectorTileLayer( tileProviders: style.providers, theme: style.theme, + concurrency: 4, ), loading: () => const SizedBox.shrink(), error: (e, _) => const SizedBox.shrink(),