@@ -38,7 +38,7 @@ class StreamingSyncImplementation implements StreamingSync {
3838 final BucketStorage adapter;
3939 final InternalConnector connector;
4040 final ResolvedSyncOptions options;
41- final List <SubscribedStream > activeSubscriptions ;
41+ List <SubscribedStream > _activeSubscriptions ;
4242
4343 final Logger logger;
4444
@@ -72,7 +72,7 @@ class StreamingSyncImplementation implements StreamingSync {
7272 required this .crudUpdateTriggerStream,
7373 required this .options,
7474 required http.Client client,
75- this . activeSubscriptions = const [],
75+ List < SubscribedStream > activeSubscriptions = const [],
7676 Mutex ? syncMutex,
7777 Mutex ? crudMutex,
7878 Logger ? logger,
@@ -84,7 +84,8 @@ class StreamingSyncImplementation implements StreamingSync {
8484 syncMutex = syncMutex ?? Mutex (identifier: "sync-$identifier " ),
8585 crudMutex = crudMutex ?? Mutex (identifier: "crud-$identifier " ),
8686 _userAgentHeaders = userAgentHeaders (),
87- logger = logger ?? isolateLogger;
87+ logger = logger ?? isolateLogger,
88+ _activeSubscriptions = activeSubscriptions;
8889
8990 Duration get _retryDelay => options.retryDelay;
9091
@@ -128,6 +129,13 @@ class StreamingSyncImplementation implements StreamingSync {
128129 return _abort? .aborted ?? false ;
129130 }
130131
132+ void updateSubscriptions (List <SubscribedStream > streams) {
133+ _activeSubscriptions = streams;
134+ if (_nonLineSyncEvents.hasListener) {
135+ _nonLineSyncEvents.add (const AbortCurrentIteration ());
136+ }
137+ }
138+
131139 @override
132140 Future <void > streamingSync () async {
133141 try {
@@ -609,7 +617,7 @@ final class _ActiveRustStreamingIteration {
609617 'parameters' : sync .options.params,
610618 'schema' : convert.json.decode (sync .schemaJson),
611619 'include_defaults' : sync .options.includeDefaultStreams,
612- 'active_streams' : sync .activeSubscriptions
620+ 'active_streams' : sync ._activeSubscriptions
613621 .map ((s) => {'name' : s.name, 'params' : s.parameters})
614622 }),
615623 );
0 commit comments