mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: reduce API request delays to improve responsiveness
- Reduced minimum requestDelaySeconds from 5s to 1s in UI slider - Changed default requestDelaySeconds from 10s to 2s - Updated Math.max constraint from 5s to 1s minimum - Updated tests to reflect new default values This addresses the issue where API requests were taking too long to respond, causing poor user experience. Users can now set delays as low as 1 second and the default is a more reasonable 2 seconds. Fixes #9438
This commit is contained in:
parent
f7d6daedff
commit
a5aad6373b
4 changed files with 9 additions and 9 deletions
|
|
@ -700,7 +700,7 @@ describe("Cline", () => {
|
|||
// Set alwaysApproveResubmit and requestDelaySeconds
|
||||
mockProvider.getState = vi.fn().mockResolvedValue({
|
||||
alwaysApproveResubmit: true,
|
||||
requestDelaySeconds: 3,
|
||||
requestDelaySeconds: 2,
|
||||
})
|
||||
|
||||
// Mock previous API request message
|
||||
|
|
@ -723,7 +723,7 @@ describe("Cline", () => {
|
|||
await iterator.next()
|
||||
|
||||
// Calculate expected delay for first retry
|
||||
const baseDelay = 3 // from requestDelaySeconds
|
||||
const baseDelay = 2 // from requestDelaySeconds
|
||||
|
||||
// Verify countdown messages
|
||||
for (let i = baseDelay; i > 0; i--) {
|
||||
|
|
@ -824,7 +824,7 @@ describe("Cline", () => {
|
|||
// Set alwaysApproveResubmit and requestDelaySeconds
|
||||
mockProvider.getState = vi.fn().mockResolvedValue({
|
||||
alwaysApproveResubmit: true,
|
||||
requestDelaySeconds: 3,
|
||||
requestDelaySeconds: 2,
|
||||
})
|
||||
|
||||
// Mock previous API request message
|
||||
|
|
@ -847,7 +847,7 @@ describe("Cline", () => {
|
|||
await iterator.next()
|
||||
|
||||
// Verify delay is only applied for the countdown
|
||||
const baseDelay = 3 // from requestDelaySeconds
|
||||
const baseDelay = 2 // from requestDelaySeconds
|
||||
const expectedDelayCount = baseDelay // One delay per second for countdown
|
||||
expect(mockDelay).toHaveBeenCalledTimes(expectedDelayCount)
|
||||
expect(mockDelay).toHaveBeenCalledWith(1000) // Each delay should be 1 second
|
||||
|
|
|
|||
|
|
@ -2019,7 +2019,7 @@ export class ClineProvider
|
|||
mcpEnabled: mcpEnabled ?? true,
|
||||
enableMcpServerCreation: enableMcpServerCreation ?? true,
|
||||
alwaysApproveResubmit: alwaysApproveResubmit ?? false,
|
||||
requestDelaySeconds: requestDelaySeconds ?? 10,
|
||||
requestDelaySeconds: requestDelaySeconds ?? 2,
|
||||
currentApiConfigName: currentApiConfigName ?? "default",
|
||||
listApiConfigMeta: listApiConfigMeta ?? [],
|
||||
pinnedApiConfigs: pinnedApiConfigs ?? {},
|
||||
|
|
@ -2247,7 +2247,7 @@ export class ClineProvider
|
|||
enableMcpServerCreation: stateValues.enableMcpServerCreation ?? true,
|
||||
mcpServers: this.mcpHub?.getAllServers() ?? [],
|
||||
alwaysApproveResubmit: stateValues.alwaysApproveResubmit ?? false,
|
||||
requestDelaySeconds: Math.max(5, stateValues.requestDelaySeconds ?? 10),
|
||||
requestDelaySeconds: Math.max(1, stateValues.requestDelaySeconds ?? 2),
|
||||
currentApiConfigName: stateValues.currentApiConfigName ?? "default",
|
||||
listApiConfigMeta: stateValues.listApiConfigMeta ?? [],
|
||||
pinnedApiConfigs: stateValues.pinnedApiConfigs ?? {},
|
||||
|
|
|
|||
|
|
@ -823,7 +823,7 @@ describe("ClineProvider", () => {
|
|||
expect(mockPostMessage).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test("requestDelaySeconds defaults to 10 seconds", async () => {
|
||||
test("requestDelaySeconds defaults to 2 seconds", async () => {
|
||||
// Mock globalState.get to return undefined for requestDelaySeconds
|
||||
;(mockContext.globalState.get as any).mockImplementation((key: string) => {
|
||||
if (key === "requestDelaySeconds") {
|
||||
|
|
@ -833,7 +833,7 @@ describe("ClineProvider", () => {
|
|||
})
|
||||
|
||||
const state = await provider.getState()
|
||||
expect(state.requestDelaySeconds).toBe(10)
|
||||
expect(state.requestDelaySeconds).toBe(2)
|
||||
})
|
||||
|
||||
test("alwaysApproveResubmit defaults to false", async () => {
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ export const AutoApproveSettings = ({
|
|||
<div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Slider
|
||||
min={5}
|
||||
min={1}
|
||||
max={100}
|
||||
step={1}
|
||||
value={[requestDelaySeconds]}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue