Skip to content

Commit

Permalink
Properly clean up shape
Browse files Browse the repository at this point in the history
  • Loading branch information
msfstef committed Nov 26, 2024
1 parent 3d7c423 commit c87c4cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/sync-service/lib/electric/shape_cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c87c4cd

Please sign in to comment.