Skip to content

Commit 853aaa1

Browse files
committed
Warn on missing updates stream
1 parent ba18a9f commit 853aaa1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/powersync_core/lib/src/web/sync_worker.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import 'package:web/web.dart' hide RequestMode;
2020
import 'sync_worker_protocol.dart';
2121
import 'web_bucket_storage.dart';
2222

23-
final _logger = autoLogger;
23+
final _logger = debugLogger;
2424

2525
void main() {
2626
_SyncWorker().start();
@@ -244,14 +244,18 @@ class _SyncRunner {
244244
final crudThrottleTime = Duration(milliseconds: crudThrottleTimeMs);
245245
Stream<UpdateNotification> crudStream =
246246
powerSyncUpdateNotifications(Stream.empty());
247-
if (database.updates != null) {
248-
final filteredStream = database.updates!
249-
.transform(UpdateNotification.filterTablesTransformer(tables));
247+
if (database.updates case final updates?) {
248+
final filteredStream =
249+
updates.transform(UpdateNotification.filterTablesTransformer(tables));
250250
crudStream = UpdateNotification.throttleStream(
251251
filteredStream,
252252
crudThrottleTime,
253253
addOne: UpdateNotification.empty(),
254254
);
255+
} else {
256+
_logger.warning(
257+
'Database is missing updates stream, sync worker will not upload '
258+
'reliably.');
255259
}
256260

257261
final syncParams = syncParamsEncoded == null

0 commit comments

Comments
 (0)