Skip to content

Conversation

@Artuomka
Copy link
Collaborator

No description provided.

…ling

- Introduced a Timeout decorator to set custom timeout values for controllers.
- Implemented TimeoutInterceptor to manage request timeouts based on the decorator.
- Applied the Timeout decorator to various controllers: Dashboard Widgets, Dashboards, Saved DB Queries, Table Widget, and SaaS Controller.
- Updated the TimeoutInterceptor to utilize the new decorator for dynamic timeout management.
- Added default timeout values for production and testing environments.
Copilot AI review requested due to automatic review settings January 23, 2026 17:06
@Artuomka Artuomka enabled auto-merge January 23, 2026 17:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the timeout mechanism from a global interceptor to a decorator-based approach, allowing for flexible, per-controller and per-endpoint timeout configurations.

Changes:

  • Introduced a new @Timeout() decorator with predefined timeout constants (DEFAULT, EXTENDED, AI)
  • Updated TimeoutInterceptor to use NestJS Reflector to read timeout metadata from decorators
  • Removed the global TimeoutInterceptor from APP_INTERCEPTOR providers in app.module.ts
  • Applied @Timeout() decorator to 25+ controllers at the class level
  • Applied method-level @Timeout() decorators with extended values to specific endpoints (table operations, AI requests)

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
backend/src/decorators/timeout.decorator.ts New decorator definition with timeout constants
backend/src/interceptors/timeout.interceptor.ts Updated to read metadata via Reflector
backend/src/app.module.ts Removed global interceptor registration
backend/src/decorators/index.ts Exported new decorator
backend/src/app.controller.ts Added @timeout() decorator
backend/src/entities/*/**.controller.ts Applied @timeout() to 24 entity controllers
backend/src/microservices/saas-microservice/saas.controller.ts Applied @timeout() decorator
backend/src/entities/ai/user-ai-requests-v2.controller.ts Added method-level @timeout with AI-specific values
backend/src/entities/table/table.controller.ts Added method-level @timeout for extended operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

export const TimeoutDefaults = {
DEFAULT: 15000,
DEFAULT_TEST: 200000,
EXTENDED: 60000,
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The EXTENDED_TEST timeout value is too high (300000ms = 5 minutes) compared to the EXTENDED value (60000ms = 1 minute). This is inconsistent with the DEFAULT/DEFAULT_TEST ratio where TEST is ~13x the normal value. Consider adjusting EXTENDED_TEST to match the pattern, or if this is intentional, add a comment explaining why.

Suggested change
EXTENDED: 60000,
EXTENDED: 60000,
// Note: EXTENDED_TEST is intentionally capped at 5 minutes (5x EXTENDED) to avoid excessively long test runs.

Copilot uses AI. Check for mistakes.
@Artuomka Artuomka merged commit 3090d71 into main Jan 23, 2026
25 checks passed
@Artuomka Artuomka deleted the backend_controller_timeouts branch January 23, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants