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 {
154
154
}
155
155
}
156
156
}
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 {
56
56
final Map <ClientConnection , _ConnectionState > _state = {};
57
57
58
58
AsyncSqliteDatabase ({required this .database})
59
- : _updates = database.updatedTables
60
- .pauseAfterEvent (const Duration (milliseconds: 1 ));
59
+ : _updates = database.updatedTables;
61
60
62
61
_ConnectionState _findState (ClientConnection connection) {
63
62
return _state.putIfAbsent (connection, _ConnectionState .new );
@@ -145,12 +144,13 @@ class AsyncSqliteDatabase extends WorkerDatabase {
145
144
state.unsubscribeUpdates ();
146
145
_registerCloseListener (state, connection);
147
146
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 (
150
150
CustomDatabaseMessageKind .notifyUpdates,
151
151
id,
152
152
tables.toList (),
153
- ));
153
+ ))) ;
154
154
});
155
155
} else {
156
156
state.unsubscribeUpdates ();
You can’t perform that action at this time.
0 commit comments