From c87c4cd8176fd94e9f43c48b77f232a392433af1 Mon Sep 17 00:00:00 2001 From: msfstef Date: Tue, 26 Nov 2024 19:35:43 +0200 Subject: [PATCH] Properly clean up shape --- packages/sync-service/lib/electric/shape_cache.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/sync-service/lib/electric/shape_cache.ex b/packages/sync-service/lib/electric/shape_cache.ex index 44f7c8a71d..aec0b9ef73 100644 --- a/packages/sync-service/lib/electric/shape_cache.ex +++ b/packages/sync-service/lib/electric/shape_cache.ex @@ -323,8 +323,10 @@ defmodule Electric.ShapeCache do rescue e -> Logger.error("Failed to recover shape #{shape_handle}: #{inspect(e)}") - shape_opts = Electric.ShapeCache.Storage.for_shape(shape_handle, state.storage) - Electric.ShapeCache.Storage.unsafe_cleanup!({state.storage, shape_opts}) + + # clean up corrupted data to avoid persisting bad state + Electric.ShapeCache.Storage.for_shape(shape_handle, state.storage) + |> Electric.ShapeCache.Storage.unsafe_cleanup!() end end) end