Skip to content

Commit dcf0f8e

Browse files
committed
Remove hash as well when unlinking
1 parent 5c0d506 commit dcf0f8e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/sync-service/lib/electric/shape_cache/shape_status.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ defmodule Electric.ShapeCache.ShapeStatus do
153153
def unlink_handle_from_shape(stack_ref, shape_handle) do
154154
stack_id = extract_stack_id(stack_ref)
155155
shape = ShapeDb.unlink_handle_from_shape!(stack_id, shape_handle)
156+
157+
:ets.update_element(
158+
shape_meta_table(stack_ref),
159+
shape_handle,
160+
{@shape_meta_shape_hash_pos, nil}
161+
)
162+
156163
{:ok, shape}
157164
rescue
158165
ArgumentError ->

packages/sync-service/test/electric/shape_cache/shape_status_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ defmodule Electric.ShapeCache.ShapeStatusTest do
114114

115115
# After unlinking, the shape should not be findable via get_existing_shape
116116
refute ShapeStatus.get_existing_shape(state, shape)
117+
refute ShapeStatus.has_shape_handle?(state, shape_handle)
117118

118119
# But the shape should still be fetchable by handle (metadata still exists)
119120
assert {:ok, ^shape} = ShapeStatus.fetch_shape_by_handle(state, shape_handle)

0 commit comments

Comments
 (0)