Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KXI-45655 - Connections Randomly Dropping #307

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 10 additions & 2 deletions src/classes/insightsConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,22 +453,30 @@ export class InsightsConnection {
const body = {
labels: {},
};
const startTime = Date.now();

return await axios
.request({
method: "post",
url: pingURL.toString(),
data: body,
headers: { Authorization: `Bearer ${userToken.accessToken}` },
timeout: 1000,
timeout: 2000,
})
.then((_response: any) => {
Telemetry.sendEvent("Insights.Pinged");
return true;
})
.catch((_error: any) => {
const endTime = Date.now();
const timeString = new Date().toLocaleTimeString();
const timeDiff = endTime - startTime;
ext.outputChannel.appendLine(
`[${timeString}] Connection keep alive error: ${this.connLabel}. Ping failed. ${_error.code}: status code ${_error.response.status}. Time Elapsed ${timeDiff}ms`,
);

window.showErrorMessage(
`The Insights connection: ${this.connLabel} cannot be reached, the connection closed.`,
`Error in connection: ${this.connLabel}, check kdb OUTPUT for more info.`,
);
return false;
});
Expand Down
4 changes: 2 additions & 2 deletions src/services/connectionManagerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export class ConnectionManagementService {
}
Telemetry.sendEvent("Connection.Disconnected." + connType);
ext.outputChannel.appendLine(
`Connection stopped from ${connection.connLabel}`,
`[${new Date().toLocaleTimeString()}] Connection disconnected: ${connection.connLabel}`,
);
ext.serverProvider.reload();
}
Expand Down Expand Up @@ -376,6 +376,6 @@ export class ConnectionManagementService {
} else {
clearInterval(intervalConns);
}
}, 60000);
}, 120000);
}
}
Loading