-
Notifications
You must be signed in to change notification settings - Fork 1k
Use performance.now instead of Date.now #2583
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
Conversation
🦋 Changeset detectedLatest commit: 9e35f09 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
We absolutely do. |
src/core/task/__tests__/Task.spec.ts
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename
Reported by email