Skip to content

Commit 1a12e86

Browse files
authored
When we dispose of a provider session, unsubscribe from memory. (#1814)
1 parent 563c751 commit 1a12e86

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

packages/memory/interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ export interface MemorySession<Space extends MemorySpace = MemorySpace>
482482
}
483483

484484
export interface Subscriber<Space extends MemorySpace = MemorySpace> {
485+
// Notifies a subscriber of a commit that has been applied
485486
commit(commit: Commit<Space>): AwaitResult<Unit, SystemError>;
486487
close(): AwaitResult<Unit, SystemError>;
487488
}

packages/memory/provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ class MemoryProviderSession<
247247
return { ok: {} };
248248
}
249249
dispose() {
250+
this.memory.unsubscribe(this);
250251
this.controller = undefined;
251252
this.sessions?.delete(this);
252253
this.sessions = null;

0 commit comments

Comments
 (0)