mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-10 03:28:03 +00:00
fix: address PR review feedback
- Add public getter method getMultiInstanceConfig() to GlobalStateQueueStorage to fix encapsulation issue - Update QueuedTelemetryClient to use the new getter method instead of accessing private property - Add mock for QueuedTelemetryClient in CloudService tests to fix failing unit tests - All tests now passing on both Ubuntu and Windows platforms
This commit is contained in:
parent
afe1ccef3b
commit
1ffa1fabf3
3 changed files with 39 additions and 3 deletions
|
|
@ -34,6 +34,33 @@ vi.mock("../ShareService")
|
|||
|
||||
vi.mock("../TelemetryClient")
|
||||
|
||||
vi.mock("../queue", () => ({
|
||||
QueuedTelemetryClient: vi.fn().mockImplementation(() => ({
|
||||
capture: vi.fn().mockResolvedValue(undefined),
|
||||
processQueue: vi.fn().mockResolvedValue(0),
|
||||
getQueueStatus: vi.fn().mockResolvedValue({
|
||||
queueSize: 0,
|
||||
oldestEventAge: undefined,
|
||||
processingState: "idle",
|
||||
lastProcessedAt: undefined,
|
||||
lastError: undefined,
|
||||
storageStats: {
|
||||
sizeInBytes: 0,
|
||||
sizeInMB: 0,
|
||||
utilizationPercent: 0,
|
||||
eventCount: 0,
|
||||
},
|
||||
}),
|
||||
getLockStats: vi.fn().mockResolvedValue({
|
||||
hasLock: false,
|
||||
lockHolder: undefined,
|
||||
lockAge: undefined,
|
||||
isExpired: undefined,
|
||||
}),
|
||||
shutdown: vi.fn().mockResolvedValue(undefined),
|
||||
})),
|
||||
}))
|
||||
|
||||
describe("CloudService", () => {
|
||||
let mockContext: vscode.ExtensionContext
|
||||
let mockAuthService: {
|
||||
|
|
|
|||
|
|
@ -371,4 +371,11 @@ export class GlobalStateQueueStorage implements QueueStorage {
|
|||
hostname: this.hostname,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get multi-instance configuration
|
||||
*/
|
||||
getMultiInstanceConfig(): Required<MultiInstanceConfig> {
|
||||
return this.multiInstanceConfig
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ export class QueuedTelemetryClient extends BaseTelemetryClient {
|
|||
* Set up periodic queue processing for leader mode
|
||||
*/
|
||||
private setupPeriodicProcessing(): void {
|
||||
const interval = this.storage["multiInstanceConfig"].lockCheckIntervalMs || 5000
|
||||
const config = this.storage.getMultiInstanceConfig()
|
||||
const interval = config.lockCheckIntervalMs || 5000
|
||||
|
||||
this.processingInterval = setInterval(async () => {
|
||||
try {
|
||||
|
|
@ -111,13 +112,14 @@ export class QueuedTelemetryClient extends BaseTelemetryClient {
|
|||
> {
|
||||
const status = await this.queue.getStatus()
|
||||
const instanceInfo = this.storage.getInstanceInfo()
|
||||
const config = this.storage.getMultiInstanceConfig()
|
||||
|
||||
return {
|
||||
...status,
|
||||
instanceInfo: {
|
||||
...instanceInfo,
|
||||
multiInstanceEnabled: this.storage["multiInstanceConfig"].enabled,
|
||||
multiInstanceMode: this.storage["multiInstanceConfig"].mode,
|
||||
multiInstanceEnabled: config.enabled,
|
||||
multiInstanceMode: config.mode,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue