File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
packages/powersync_core/lib/src/sync Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -358,10 +358,6 @@ final class _SyncStreamSubscriptionHandle implements SyncStreamSubscription {
358
358
359
359
_SyncStreamSubscriptionHandle (this ._source) {
360
360
_source.refcount++ ;
361
-
362
- // This is not unreliable, but can help decrementing refcounts on the inner
363
- // subscription when this handle is deallocated without [unsubscribe] being
364
- // called.
365
361
_finalizer.attach (this , _source, detach: this );
366
362
}
367
363
@@ -385,6 +381,12 @@ final class _SyncStreamSubscriptionHandle implements SyncStreamSubscription {
385
381
});
386
382
}
387
383
388
- static final Finalizer <_ActiveSubscription > _finalizer =
389
- Finalizer ((sub) => sub.decrementRefCount ());
384
+ static final Finalizer <_ActiveSubscription > _finalizer = Finalizer ((sub) {
385
+ sub.connections.db.logger.warning (
386
+ 'A subscription to ${sub .name } (with parameters ${sub .parameters }) '
387
+ 'leaked! Please ensure calling SyncStreamSubscription.unsubscribe() '
388
+ "when you don't need a subscription anymore. For global "
389
+ 'subscriptions, consider storing them in global fields to avoid this '
390
+ 'warning.' );
391
+ });
390
392
}
You can’t perform that action at this time.
0 commit comments