Skip to content

perf: Paraellelize calls in team event type SSR#27486

Merged
joeauyeung merged 4 commits intomainfrom
parallelize-team-event-ssr-clean
Feb 3, 2026
Merged

perf: Paraellelize calls in team event type SSR#27486
joeauyeung merged 4 commits intomainfrom
parallelize-team-event-ssr-clean

Conversation

@joeauyeung
Copy link
Copy Markdown
Contributor

@joeauyeung joeauyeung commented Feb 2, 2026

What does this PR do?

  • Wraps getUsersData, CRM lookup, feature flag check, and getting rescheduled booking in a Promise.all

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • Load an event type
  • Load an event type with CRM lookup enabled
  • Load a reschedule link

Summary by cubic

Parallelized independent server calls in team event type SSR to reduce page load time. Simplified CRM param handling and added scoped logging and error handling.

  • Performance

    • Run in parallel: host user data, CRM owner lookup (when needed), feature flag check, and booking fetch for reschedules.
    • Keep existing redirect behavior for cancelled reschedules; no functional changes to outcomes.
    • Use API v2 only when flag is true and env allows.
  • Refactors

    • Normalize CRM query params and only invoke CRM lookup if required.
    • Add sub-logger for this route and per-call error capture.
    • Remove redundant sequential session fetch by inlining into the reschedule flow.

Written for commit 8480783. Summary will update on new commits.


Open with Devin

@joeauyeung joeauyeung marked this pull request as ready for review February 2, 2026 02:08
@graphite-app graphite-app bot added the core area: core, team members only label Feb 2, 2026
@graphite-app graphite-app bot requested a review from a team February 2, 2026 02:08
@graphite-app graphite-app bot added the enterprise area: enterprise, audit log, organisation, SAML, SSO label Feb 2, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 2, 2026

E2E results are ready!

@alishaz-polymath
Copy link
Copy Markdown
Member

LGTM, but Tests Failing. Seem unrelated but worth a confirmation

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional flags.

Open in Devin Review

Comment on lines +109 to +134
getUsersData(team.isPrivate, eventTypeId, eventData.hosts.map((h) => h.user)).catch((err) => {
log.error("Failed to get users data", err);
throw err;
}),
needsCrmLookup
? import("@calcom/features/ee/teams/lib/getTeamMemberEmailFromCrm")
.then(({ getTeamMemberEmailForResponseOrContactUsingUrlQuery }) =>
getTeamMemberEmailForResponseOrContactUsingUrlQuery({ query, eventData })
)
.catch((err) => {
log.error("Failed CRM lookup", err);
throw err;
})
: Promise.resolve(null),
featureRepo.checkIfTeamHasFeature(team.id, "use-api-v2-for-team-slots").catch((err) => {
log.error("Failed to check API V2 feature flag", err);
throw err;
}),
rescheduleUid
? getServerSession({ req })
.then((session) => getBookingForReschedule(`${rescheduleUid}`, session?.user?.id))
.catch((err) => {
log.error("Failed to get booking for reschedule", err);
throw err;
})
: Promise.resolve(null),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: if we could refactor it to
Promise.all([a(),b(),c()..]) then it would be much easier to read.

@joeauyeung joeauyeung merged commit f7381d1 into main Feb 3, 2026
88 checks passed
@joeauyeung joeauyeung deleted the parallelize-team-event-ssr-clean branch February 3, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants