Skip to content

Commit

Permalink
Warn on missing updates stream
Browse files Browse the repository at this point in the history
  • Loading branch information
simolus3 committed Feb 26, 2025
1 parent ba18a9f commit 853aaa1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/powersync_core/lib/src/web/sync_worker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import 'package:web/web.dart' hide RequestMode;
import 'sync_worker_protocol.dart';
import 'web_bucket_storage.dart';

final _logger = autoLogger;
final _logger = debugLogger;

void main() {
_SyncWorker().start();
Expand Down Expand Up @@ -244,14 +244,18 @@ class _SyncRunner {
final crudThrottleTime = Duration(milliseconds: crudThrottleTimeMs);
Stream<UpdateNotification> crudStream =
powerSyncUpdateNotifications(Stream.empty());
if (database.updates != null) {
final filteredStream = database.updates!
.transform(UpdateNotification.filterTablesTransformer(tables));
if (database.updates case final updates?) {
final filteredStream =
updates.transform(UpdateNotification.filterTablesTransformer(tables));
crudStream = UpdateNotification.throttleStream(
filteredStream,
crudThrottleTime,
addOne: UpdateNotification.empty(),
);
} else {
_logger.warning(
'Database is missing updates stream, sync worker will not upload '
'reliably.');
}

final syncParams = syncParamsEncoded == null
Expand Down

0 comments on commit 853aaa1

Please sign in to comment.