-
Notifications
You must be signed in to change notification settings - Fork 128
fix(gitlab): Add configurable query timeout to GitLab client #390
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
This comment has been minimized.
This comment has been minimized.
""" WalkthroughA new environment variable, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Backend
participant GitLab API
User->>Backend: Initiate GitLab sync
Backend->>Backend: Read GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS
Backend->>GitLab API: Fetch projects (with configured timeout)
GitLab API-->>Backend: Return projects or timeout error
Backend-->>User: Sync result or troubleshooting guidance
Poem
""" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/backend/src/env.ts (1)
52-54
: Validate that the supplied timeout is positive
numberSchema
will happily coerce"0"
or a negative string.
Passing0
disables the timeout entirely and negative numbers will be cast toNaN
after the* 1000
ingitlab.ts
.- GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS: numberSchema.default(60 * 10), + GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS: numberSchema + .default(600) + .refine((n) => n > 0, { message: "Must be > 0 seconds" }),A one-line
refine
keeps the guard local and prevents subtle production mis-configs.docs/docs/connections/gitlab.mdx (1)
178-181
: Tighten wording“syncing a large number of projects” → “syncing many projects”
Reduces wordiness per LanguageTool hint.
docs/docs/configuration/environment-variables.mdx (1)
30-31
: Explicitly note the unitAdd “in seconds” to prevent confusion with the millisecond value used in code.
-| `GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS` | `600` | <p>The timeout duration (in seconds) for GitLab client queries</p> | +| `GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS` | `600` | <p>The timeout duration <strong>in seconds</strong> for GitLab client queries</p> |
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
CHANGELOG.md
(1 hunks)docs/docs/configuration/environment-variables.mdx
(1 hunks)docs/docs/connections/gitlab.mdx
(1 hunks)packages/backend/src/env.ts
(1 hunks)packages/backend/src/gitlab.ts
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/style.mdc
🧬 Code Graph Analysis (1)
packages/backend/src/gitlab.ts (1)
packages/backend/src/env.ts (1)
env
(22-58)
🪛 LanguageTool
docs/docs/connections/gitlab.mdx
[style] ~180-~180: To reduce wordiness, try specifying a number or using “many” or “numerous” instead.
Context: ...Query timeout was reached` when syncing a large number of projects, you can increase the client's...
(LARGE_NUMBER_OF)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (2)
CHANGELOG.md (1)
10-12
: Changelog entry LGTMEntry follows Keep a Changelog conventions and references the PR.
packages/backend/src/gitlab.ts (1)
32-33
: Ignore therequestTimeout
suggestion—queryTimeout
is correct
@gitbeaker/rest
does not support arequestTimeout
option for REST endpoints; it usesqueryTimeout
(ms) to control API call timeouts. No change is needed.• Location: packages/backend/src/gitlab.ts lines 32–33
• Keep using:queryTimeout: env.GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS * 1000,Likely an incorrect or invalid review comment.
Makes the query timeout configurable for the GitLab client via the
GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS
env var.Fixes #162
Summary by CodeRabbit
New Features
GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS
, allowing users to configure the timeout duration for GitLab client queries (default: 600 seconds).Documentation
GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS
.