1937
1938
unsubscribe(resource: URI, clientId: string): void {
1939
>
const set = this._resourceSubscribers.get(resource);
agentService.ts
1940
>
if (!set) {
1941
return;
1942
}
1944
>
if (set.size > 0) {
1945
return;
1946
}
1948
>
this._changesetCoordinator.onLastSubscriber(resource);
1949
>
this._stateManager.onChangesetLivenessChanged();
1950
>
// An empty session whose last subscriber dropped is a candidate for
1951
>
// full GC (provider session, worktree, on-disk state). Sessions with
1952
>
// at least one turn fall through to {@link _maybeEvictIdleSession},
1953
>
// which only drops the in-memory cache and lets the session be
1954
>
// restored from disk later. Skipping eviction here for empty
1955
>
// sessions ensures their state stays observable so a re-subscribe
1956
>
// can re-arm GC.
1957
>
if (this._maybeScheduleSessionGc(resource)) {
1958
return;
1959
}