File tree Expand file tree Collapse file tree 2 files changed +5
-14
lines changed
packages/sqlite_async/lib/src Expand file tree Collapse file tree 2 files changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -154,12 +154,3 @@ class _UpdateListener {
154154 }
155155 }
156156}
157-
158- extension StreamUtils <T > on Stream <T > {
159- Stream <T > pauseAfterEvent (Duration duration) async * {
160- await for (final event in this ) {
161- yield event;
162- await Future .delayed (duration);
163- }
164- }
165- }
Original file line number Diff line number Diff line change @@ -56,8 +56,7 @@ class AsyncSqliteDatabase extends WorkerDatabase {
5656 final Map <ClientConnection , _ConnectionState > _state = {};
5757
5858 AsyncSqliteDatabase ({required this .database})
59- : _updates = database.updatedTables
60- .pauseAfterEvent (const Duration (milliseconds: 1 ));
59+ : _updates = database.updatedTables;
6160
6261 _ConnectionState _findState (ClientConnection connection) {
6362 return _state.putIfAbsent (connection, _ConnectionState .new );
@@ -145,12 +144,13 @@ class AsyncSqliteDatabase extends WorkerDatabase {
145144 state.unsubscribeUpdates ();
146145 _registerCloseListener (state, connection);
147146
148- state.updatesNotification = _updates.listen ((tables) {
149- connection.customRequest (CustomDatabaseMessage (
147+ late StreamSubscription <void > subscription;
148+ subscription = state.updatesNotification = _updates.listen ((tables) {
149+ subscription.pause (connection.customRequest (CustomDatabaseMessage (
150150 CustomDatabaseMessageKind .notifyUpdates,
151151 id,
152152 tables.toList (),
153- ));
153+ ))) ;
154154 });
155155 } else {
156156 state.unsubscribeUpdates ();
You can’t perform that action at this time.
0 commit comments