Fix concurrent modification in stream query store

closes #13
This commit is contained in:
Simon Binder 2019-03-31 18:58:08 +02:00
parent 6d45805035
commit 50076102ac
No known key found for this signature in database
GPG Key ID: B807FDF954BA00CF
1 changed files with 2 additions and 1 deletions

View File

@ -88,7 +88,8 @@ class StreamQueryStore {
/// Handles updates on a given table by re-executing all queries that read /// Handles updates on a given table by re-executing all queries that read
/// from that table. /// from that table.
Future<void> handleTableUpdates(Set<TableInfo> tables) async { Future<void> handleTableUpdates(Set<TableInfo> tables) async {
final affectedStreams = _activeStreams final activeStreams = List<QueryStream>.from(_activeStreams);
final affectedStreams = activeStreams
.where((stream) => stream._fetcher.readsFrom.any(tables.contains)); .where((stream) => stream._fetcher.readsFrom.any(tables.contains));
for (var stream in affectedStreams) { for (var stream in affectedStreams) {