@@ -19,7 +19,6 @@ defmodule Electric.Shapes.Consumer.EventHandler.Subqueries.Steady do
1919 :dnf_plan ,
2020 views: % { } ,
2121 dependency_handle_to_ref: % { } ,
22- latest_seen_lsn: nil ,
2322 queue: MoveQueue . new ( ) ,
2423 buffer_max_transactions: 1000
2524 ]
@@ -31,7 +30,6 @@ defmodule Electric.Shapes.Consumer.EventHandler.Subqueries.Steady do
3130 dnf_plan: DnfPlan . t ( ) ,
3231 views: % { [ String . t ( ) ] => MapSet . t ( ) } ,
3332 dependency_handle_to_ref: % { String . t ( ) => { non_neg_integer ( ) , [ String . t ( ) ] } } ,
34- latest_seen_lsn: Electric.Postgres.Lsn . t ( ) | nil ,
3533 queue: MoveQueue . t ( ) ,
3634 buffer_max_transactions: pos_integer ( )
3735 }
@@ -55,8 +53,9 @@ defmodule Electric.Shapes.Consumer.EventHandler.Subqueries.Steady do
5553 end
5654 end
5755
58- def handle_event ( state , { :global_last_seen_lsn , lsn } ) do
59- { :ok , % { state | latest_seen_lsn: Subqueries . normalize_global_lsn ( lsn ) } , % Plan { } }
56+ def handle_event ( state , { :global_last_seen_lsn , _lsn } ) do
57+ # Straggler message after unsubscribe; ignore.
58+ { :ok , state , % Plan { } }
6059 end
6160
6261 def handle_event ( state , { :materializer_changes , dep_handle , payload } ) do
@@ -126,7 +125,12 @@ defmodule Electric.Shapes.Consumer.EventHandler.Subqueries.Steady do
126125
127126 plan = % {
128127 plan
129- | effects: plan . effects ++ [ % Electric.Shapes.Consumer.Effect.StartMoveInQuery { } ]
128+ | effects:
129+ plan . effects ++
130+ [
131+ % Electric.Shapes.Consumer.Effect.SubscribeGlobalLsn { } ,
132+ % Electric.Shapes.Consumer.Effect.StartMoveInQuery { }
133+ ]
130134 }
131135
132136 { :ok , buffering , plan }
@@ -150,7 +154,12 @@ defmodule Electric.Shapes.Consumer.EventHandler.Subqueries.Steady do
150154
151155 plan = % {
152156 plan
153- | effects: plan . effects ++ [ % Electric.Shapes.Consumer.Effect.StartMoveInQuery { } ]
157+ | effects:
158+ plan . effects ++
159+ [
160+ % Electric.Shapes.Consumer.Effect.SubscribeGlobalLsn { } ,
161+ % Electric.Shapes.Consumer.Effect.StartMoveInQuery { }
162+ ]
154163 }
155164
156165 { :ok , buffering , plan }
0 commit comments