don't overflow the server
This commit is contained in:
parent
ea1a4a4a31
commit
05e9a9b688
2 changed files with 6 additions and 2 deletions
|
|
@ -69,8 +69,11 @@ pub async fn get_tile(
|
|||
// Fetch from Martin
|
||||
let (data, etag): (Bytes, Option<String>) = 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")
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ class _MapScreenState extends ConsumerState<MapScreen> {
|
|||
data: (style) => VectorTileLayer(
|
||||
tileProviders: style.providers,
|
||||
theme: style.theme,
|
||||
concurrency: 4,
|
||||
),
|
||||
loading: () => const SizedBox.shrink(),
|
||||
error: (e, _) => const SizedBox.shrink(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue