Compare commits

...

2 commits

Author SHA1 Message Date
Shautvast
08ea09a347 get front end to work 2026-04-03 17:23:36 +02:00
Shautvast
879ab82cae reuse redis connection 2026-04-03 17:23:24 +02:00
3 changed files with 16 additions and 3 deletions

View file

@ -1,20 +1,29 @@
use redis::AsyncCommands;
use sha2::{Digest, Sha256};
use tokio::sync::OnceCell;
/// Redis caching layer implementing the key patterns and TTLs
/// defined in DATA_MODEL.md section 3.
pub struct CacheService {
client: redis::Client,
conn: OnceCell<redis::aio::MultiplexedConnection>,
}
impl CacheService {
pub fn new(redis_url: &str) -> Result<Self, redis::RedisError> {
let client = redis::Client::open(redis_url)?;
Ok(Self { client })
Ok(Self {
client,
conn: OnceCell::new(),
})
}
async fn conn(&self) -> Result<redis::aio::MultiplexedConnection, redis::RedisError> {
self.client.get_multiplexed_async_connection().await
let conn = self
.conn
.get_or_try_init(|| self.client.get_multiplexed_async_connection())
.await?;
Ok(conn.clone())
}
// ── Tile cache ──────────────────────────────────────────────

View file

@ -29,7 +29,7 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Disable Impeller/Vulkan — fallback to Skia/OpenGL for devices with poor Vulkan support -->
<!-- Disable Impeller/Vulkan — vector_map_tiles canvas ops are incompatible with Impeller -->
<meta-data
android:name="io.flutter.embedding.android.EnableImpeller"
android:value="false" />

View file

@ -23,6 +23,9 @@ class _MapScreenState extends ConsumerState<MapScreen> {
void initState() {
super.initState();
_mapController = MapController();
WidgetsBinding.instance.addPostFrameCallback((_) {
ref.read(mapProvider.notifier).locateUser();
});
}
@override
@ -50,6 +53,7 @@ class _MapScreenState extends ConsumerState<MapScreen> {
FlutterMap(
mapController: _mapController,
options: MapOptions(
backgroundColor: Colors.transparent,
initialCenter: mapState.center,
initialZoom: mapState.zoom,
minZoom: 0,