fix: address PR review comments

- Remove unused _isNetworkError variable in PostHogTelemetryClient
- Add TelemetryQueueManager.resetInstance() call in extension deactivation to prevent memory leaks and stale data when switching workspaces
This commit is contained in:
daniel-lxs 2025-08-15 15:07:21 -05:00
parent 4dbb5eae1d
commit 1f0890919a
No known key found for this signature in database
GPG key ID: 21C74479048B3AA6
2 changed files with 6 additions and 8 deletions

View file

@ -97,14 +97,6 @@ export class PostHogTelemetryClient extends QueuedTelemetryClient {
// Differentiate between different types of errors
const errorMessage = error instanceof Error ? error.message : String(error)
// Check if it's a network error or other transient issue
const _isNetworkError =
errorMessage.toLowerCase().includes("network") ||
errorMessage.toLowerCase().includes("timeout") ||
errorMessage.toLowerCase().includes("econnrefused") ||
errorMessage.toLowerCase().includes("enotfound") ||
errorMessage.toLowerCase().includes("fetch")
// Check if it's a configuration error that won't be fixed by retrying
const isConfigError =
errorMessage.toLowerCase().includes("api key") ||

View file

@ -290,5 +290,11 @@ export async function deactivate() {
await McpServerManager.cleanup(extensionContext)
TelemetryService.instance.shutdown()
// Clean up the telemetry queue manager singleton to prevent memory leaks
// and stale data when switching workspaces
const { TelemetryQueueManager } = await import("@roo-code/telemetry")
TelemetryQueueManager.resetInstance()
TerminalRegistry.cleanup()
}