Skip to content

Commit

Permalink
LoaderContainerTracker: Move patching container's clone function befo…
Browse files Browse the repository at this point in the history
…re any filtering (microsoft#17129)

Follow up to microsoft#16987. Moved the patching of container's clone function to
the beginning of `addContainer` before any filtering happens. The reason
is that LoaderContainerTracker should be aware of all containers that
are created and it decides whether to track it or not.
  • Loading branch information
agarwal-navin authored Sep 1, 2023
1 parent a830eca commit 9056d44
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions packages/test/test-utils/src/loaderContainerTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,11 @@ export class LoaderContainerTracker implements IOpProcessingController {
* @param container - container to add
*/
private addContainer(container: IContainer) {
// ignore summarizer
if (
!container.deltaManager.clientDetails.capabilities.interactive &&
!this.syncSummarizerClients
) {
return;
}

// don't add container that is already tracked
if (this.containers.has(container)) {
return;
}

const record = {
index: this.containers.size,
paused: false,
startTrailingNoOps: 0,
trailingNoOps: 0,
lastProposal: 0,
};
this.containers.set(container, record);
this.trackTrailingNoOps(container, record);
this.trackLastProposal(container);
this.setupTrace(container, record.index);

// Container has a `clone` method that can be used to create another container without going through
// the Loader. Such containers won't be added by the `add` method so do it here. For example, summarizer
// containers are created via the `clone` method.
Expand All @@ -125,6 +105,26 @@ export class LoaderContainerTracker implements IOpProcessingController {
};
containerWithClone.clone = patch(containerWithClone.clone);
}

// ignore summarizer
if (
!container.deltaManager.clientDetails.capabilities.interactive &&
!this.syncSummarizerClients
) {
return;
}

const record = {
index: this.containers.size,
paused: false,
startTrailingNoOps: 0,
trailingNoOps: 0,
lastProposal: 0,
};
this.containers.set(container, record);
this.trackTrailingNoOps(container, record);
this.trackLastProposal(container);
this.setupTrace(container, record.index);
}

/**
Expand Down

0 comments on commit 9056d44

Please sign in to comment.