stagas
stagas3h ago

Local KV not saving data

I find very often that local KV data are not persisted when the server restarts, not all the time but it happens. Is there a way to force KV to write-to-disk always?
2 Replies
tobsch
tobsch2h ago
Can you share how you initialize the database? Deno.openKv(":memory:"); would be lost after a server restart. Another thing I can think of: If you write to a location that is inside of a Docker container or devcontainer then it is important that you mount that location somehwhere on your host system. Otherwise it will be lost when the container is rebuilt.
stagas
stagasOP1h ago
it's not memory i do: await Deno.openKv(Deno.env.get('KV_PATH')) where KV_PATH=./storage/kv.sqlite3 so it's a local path

Did you find this page helpful?