perf: improve getTotalBookingDuration query#27383
Merged
Udit-takkar merged 13 commits intomainfrom Feb 24, 2026
Merged
Conversation
Closed
6 tasks
…uration pre-fetching Co-Authored-By: udit@cal.com <udit222001@gmail.com>
hariombalhara
previously requested changes
Feb 3, 2026
Member
hariombalhara
left a comment
There was a problem hiding this comment.
Need confirmation whether there is a bug fix as well here
added integration test with fix
Contributor
Devin AI is addressing Cubic AI's review feedbackA Devin session has been created to address the issues identified by Cubic AI. |
…st isolation Replace direct deletion of process.env variables with vi.stubEnv() to ensure automatic restoration after tests, preventing flaky tests and side effects in parallel execution. Issue identified by Cubic AI (confidence: 9/10) Co-Authored-By: unknown <>
hariombalhara
previously requested changes
Feb 9, 2026
Member
hariombalhara
left a comment
There was a problem hiding this comment.
I think we should add this warning because the code which prefetches and code that reads the prefetched data, it is good to have a warning
Contributor
Devin AI is resolving merge conflictsThis PR has merge conflicts with the Devin will:
If you prefer to resolve conflicts manually, you can close the Devin session and handle it yourself. |
…workflowSelect) Co-Authored-By: unknown <>
hariombalhara
approved these changes
Feb 24, 2026
volnei
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR fixes N+1 query in getTotalBookingDuration function.
Set this "Limit total booking duration" option with Per year
Before:-
This query was executed for n+1 times.
After:-
Only single query per year needed now, and it is reused for all users (no per‑user query).
Updates since last revision
durationLimits.integration-test.ts: replaced directprocess.envdeletion withvi.stubEnv()for automatic restoration after tests (issue identified by Cubic AI, confidence 9/10)Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Link to Devin run: https://app.devin.ai/sessions/a2ba9c6b40db40c9be060ce18c6eaa94