Skip to content

Conversation

@chrarnoldus
Copy link
Collaborator

Reported by email

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2025

🦋 Changeset detected

Latest commit: 9e35f09

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@markijbema markijbema left a comment

Choose a reason for hiding this comment

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

Do we suspect we might have the same or similar problems elsewhere?

const now = Date.now()
const now = performance.now() // kilocode_change
const timeSinceLastRequest = now - Task.lastGlobalApiRequestTime
const rateLimit = apiConfiguration?.rateLimitSeconds || 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can try to fix it more aggressively by not waiting if rateLimit is zero anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

That does make sense, i mean than we kan skip this altogether right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, in fact if rateLimitDelay>rateLimit I think we're in trouble.

maybe Task.lastGlobalApiRequestTime being a global also causes problem.

@chrarnoldus
Copy link
Collaborator Author

Do we suspect we might have the same or similar problems elsewhere?

We absolutely do.

const mockTime = Date.now() + (mockApiConfig.rateLimitSeconds + 1) * 1000
Date.now = vi.fn(() => mockTime)
// kilocode_change start: use performance instead of Date
const originalDateNow = performance.now
Copy link
Contributor

Choose a reason for hiding this comment

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

rename

@chrarnoldus chrarnoldus merged commit c8c1a26 into main Sep 23, 2025
11 of 12 checks passed
@chrarnoldus chrarnoldus deleted the christiaan/performance-now branch September 23, 2025 13:54
gatolgaj referenced this pull request in gatolgaj/dcode Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants