Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1703,14 +1703,6 @@ const connectWithOptions = (
return;
}

// We're trying to optimise the initial Compass loading times here: to
// make sure that the driver connection pool doesn't immediately get
// overwhelmed with requests, we fetch instance info only once and then
// pass it down to telemetry and instance model. This is a relatively
// expensive dataService operation so we're trying to keep the usage
// very limited
const instanceInfo = await dataService.instance();

let showedNonRetryableErrorToast = false;
// Listen for non-retry-able errors on failed server heartbeats.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we're planning to add an e2e test for this, but it probably wouldn't hurt to add a comment also

Suggested change
// Listen for non-retry-able errors on failed server heartbeats.
// NB: Order of operations is important here. Make sure that all events
// are attached BEFORE any other command is executed with dataService as
// connect method doesn't really guarantee that connection is fully
// established and these event listeners are important part of the
// connection flow.
// Listen for non-retry-able errors on failed server heartbeats.

// These can happen on compass web when:
Expand Down Expand Up @@ -1781,6 +1773,14 @@ const connectWithOptions = (

DataServiceForConnection.set(connectionInfo.id, dataService);

// We're trying to optimise the initial Compass loading times here: to
// make sure that the driver connection pool doesn't immediately get
// overwhelmed with requests, we fetch instance info only once and then
// pass it down to telemetry and instance model. This is a relatively
// expensive dataService operation so we're trying to keep the usage
// very limited
const instanceInfo = await dataService.instance();
Comment on lines 1774 to +1782
Copy link
Collaborator

@gribnoysup gribnoysup Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either this should be before we store the dataService instance in a map, or we need to add explicit cleanup for it in the catch block below.

Suggested change
DataServiceForConnection.set(connectionInfo.id, dataService);
// We're trying to optimise the initial Compass loading times here: to
// make sure that the driver connection pool doesn't immediately get
// overwhelmed with requests, we fetch instance info only once and then
// pass it down to telemetry and instance model. This is a relatively
// expensive dataService operation so we're trying to keep the usage
// very limited
const instanceInfo = await dataService.instance();
// We're trying to optimise the initial Compass loading times here: to
// make sure that the driver connection pool doesn't immediately get
// overwhelmed with requests, we fetch instance info only once and then
// pass it down to telemetry and instance model. This is a relatively
// expensive dataService operation so we're trying to keep the usage
// very limited
const instanceInfo = await dataService.instance();
DataServiceForConnection.set(connectionInfo.id, dataService);


try {
await dispatch(
saveConnectionInfo(
Expand Down
Loading