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 {
358358
359359 _SyncStreamSubscriptionHandle (this ._source) {
360360 _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.
365361 _finalizer.attach (this , _source, detach: this );
366362 }
367363
@@ -385,6 +381,12 @@ final class _SyncStreamSubscriptionHandle implements SyncStreamSubscription {
385381 });
386382 }
387383
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+ });
390392}
You can’t perform that action at this time.
0 commit comments