Skip to content

Comments

chore: increase i18n fetch timeout to 30s for dev mode#22912

Merged
hbjORbj merged 1 commit intomainfrom
chore/dev-mode-timeout
Aug 6, 2025
Merged

chore: increase i18n fetch timeout to 30s for dev mode#22912
hbjORbj merged 1 commit intomainfrom
chore/dev-mode-timeout

Conversation

@hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Aug 6, 2025

What does this PR do?

  • 3s isn't long enough for local development for some team members

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A - 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?

  • Please use the latest Vercel preview and test please 🙏.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 6, 2025

Walkthrough

The change modifies the timeout behavior for the fetchWithTimeout call within the loadTranslations function in the packages/lib/server/i18n.ts file. The timeout is now set to 30 seconds when the environment is "development" and remains at 3 seconds for all other environments. No changes were made to the caching strategy or to any exported or public entities.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/dev-mode-timeout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@graphite-app graphite-app bot requested a review from a team August 6, 2025 04:09
@hbjORbj hbjORbj changed the title chore: dev mode timeout chore: increase i18n fetch timeout to 30s for dev mode Aug 6, 2025
@keithwillcode keithwillcode added core area: core, team members only foundation labels Aug 6, 2025
@graphite-app
Copy link

graphite-app bot commented Aug 6, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (08/06/25)

1 reviewer was added to this PR based on Keith Williams's automation.

@dosubot dosubot bot added the i18n area: i18n, translations label Aug 6, 2025
@hbjORbj hbjORbj requested a review from eunjae-lee August 6, 2025 04:10
@hbjORbj hbjORbj enabled auto-merge (squash) August 6, 2025 04:11
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
packages/lib/server/i18n.ts (1)

70-79: _i18n.init is async – missing await risks race conditions.

i18next.createInstance().init() returns a Promise; without awaiting, getFixedT can be accessed before resources are loaded, leading to empty/missing strings under load.

-  const _i18n = createInstance();
-  _i18n.init({
+  const _i18n = createInstance();
+  await _i18n.init({

After awaiting, the subsequent cache insertion and getFixedT call remain valid.

🧹 Nitpick comments (2)
packages/lib/server/i18n.ts (2)

36-39: Expose time-out values via constants or config instead of hard-coding.

Hard-coding 30000 ms for dev and 3000 ms elsewhere makes future tuning require code changes and redeploys.
Consider deriving both values from a single constant (e.g. TRANSLATION_FETCH_TIMEOUT_MS) or from process.env so SREs can adjust without code edits.


49-53: Inconsistent logger usage – fallback to console.error.

Everywhere else the file uses the shared logger, but the catch block emits with console.error, fragmenting log streams and skipping structured metadata.

-  } catch (err) {
-    console.error("loadTranslations Error:", err);
+  } catch (err) {
+    logger.error("loadTranslations Error:", err as Error);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d0dc3f and 1385042.

📒 Files selected for processing (1)
  • packages/lib/server/i18n.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/lib/server/i18n.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/lib/server/i18n.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: For large pull requests (>500 lines changed or >10 files touched), advise splitting into smaller, focused PRs by feature, layer, dependency chain, or file/module
Learnt from: alishaz-polymath
PR: calcom/cal.com#22304
File: packages/prisma/schema.prisma:1068-1071
Timestamp: 2025-07-16T05:10:22.891Z
Learning: In PR #22304 for Cal.com private link expiration features, the `maxUsageCount` field was intentionally set to default to 1 (non-nullable) as a breaking change, making all existing private links single-use after migration. This was a deliberate design decision by alishaz-polymath.
Learnt from: din-prajapati
PR: calcom/cal.com#21854
File: packages/app-store/office365calendar/__tests__/unit_tests/SubscriptionManager.test.ts:0-0
Timestamp: 2025-08-05T12:04:29.037Z
Learning: In packages/app-store/office365calendar/lib/CalendarService.ts, the fetcher method in Office365CalendarService class is public, not private. It was specifically changed from private to public in this PR to support proper testing and external access patterns.
📚 Learning: in packages/app-store/office365calendar/lib/calendarservice.ts, the fetcher method in office365calen...
Learnt from: din-prajapati
PR: calcom/cal.com#21854
File: packages/app-store/office365calendar/__tests__/unit_tests/SubscriptionManager.test.ts:0-0
Timestamp: 2025-08-05T12:04:29.037Z
Learning: In packages/app-store/office365calendar/lib/CalendarService.ts, the fetcher method in Office365CalendarService class is public, not private. It was specifically changed from private to public in this PR to support proper testing and external access patterns.

Applied to files:

  • packages/lib/server/i18n.ts

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2025

E2E results are ready!

@hbjORbj hbjORbj merged commit d764b6a into main Aug 6, 2025
80 of 86 checks passed
@hbjORbj hbjORbj deleted the chore/dev-mode-timeout branch August 6, 2025 07:56
pallava-joshi pushed a commit to pallava-joshi/cal.com that referenced this pull request Aug 8, 2025
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 foundation i18n area: i18n, translations ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants