Skip to content

Add throttling to table row retrieval endpoints#1707

Merged
Artuomka merged 1 commit intomainfrom
backend_tables_throttle
Apr 8, 2026
Merged

Add throttling to table row retrieval endpoints#1707
Artuomka merged 1 commit intomainfrom
backend_tables_throttle

Conversation

@Artuomka
Copy link
Copy Markdown
Collaborator

@Artuomka Artuomka commented Apr 8, 2026

Summary by CodeRabbit

  • API Improvements
    • Rate limiting has been implemented for table row retrieval endpoints to ensure optimal system performance and stability. Clients making frequent requests to retrieve table rows may encounter rate limit responses during peak usage periods, helping maintain service quality.

Copilot AI review requested due to automatic review settings April 8, 2026 07:41
@Artuomka Artuomka merged commit 31d909f into main Apr 8, 2026
15 of 16 checks passed
@Artuomka Artuomka deleted the backend_tables_throttle branch April 8, 2026 07:41
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 98fe1aa0-9dfd-4d73-93d0-97a5c6b61b6f

📥 Commits

Reviewing files that changed from the base of the PR and between 1c989d8 and 2ee0ac5.

📒 Files selected for processing (1)
  • backend/src/entities/table/table.controller.ts

📝 Walkthrough

Walkthrough

Rate limiting decorators were added to two table-row retrieval endpoints in the TableController. The @Throttle decorator from @nestjs/throttler was applied to findAllRows and findAllRowsWithBodyFilter methods, each configured to allow a maximum of 300 requests per 60-second window.

Changes

Cohort / File(s) Summary
Rate Limiting Configuration
backend/src/entities/table/table.controller.ts
Imported Throttle from @nestjs/throttler and applied rate limiting decorator (300 requests per 60 seconds) to two table-row retrieval endpoints: GET /table/rows/:connectionId and POST /table/rows/find/:connectionId.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 With whiskers twitching, we hop with glee,
Three lines of throttle, now requests are free—
No rushing floods through our table rows,
Just measured pace as the data flows!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backend_tables_throttle

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

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 aims to apply explicit throttling configuration to the table row retrieval endpoints in the TableController.

Changes:

  • Add @nestjs/throttler @Throttle() usage to the GET and POST “find rows” endpoints.
  • Add the Throttle import to the table controller.

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

Comment on lines 63 to 67
IImportCSVFinTable,
IUpdateRowInTable,
} from './use-cases/table-use-cases.interface.js';
import { Throttle } from '@nestjs/throttler';

Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

Throttle import is out of the usual import grouping/order (external @nestjs/* imports are grouped at the top in other controllers). Consider moving import { Throttle } from '@nestjs/throttler'; up with the other Nest imports for consistency (e.g., backend/src/entities/user/user.controller.ts:18).

Copilot uses AI. Check for mistakes.
Comment on lines 189 to 193
@ApiQuery({ name: 'search', required: false })
@Timeout(TimeoutDefaults.EXTENDED)
@Throttle({ default: { limit: 300, ttl: 60000 } })
@Get('/table/rows/:connectionId')
async findAllRows(
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

These endpoints are already rate-limited by the global ThrottlerGuard (configured in backend/src/app.module.ts:55-62 with limit: 200, ttl: 60000). Adding @Throttle({ default: { limit: 300, ttl: 60000 } }) here overrides that default and actually increases the allowed rate. If the intent is to “add/tighten throttling” for row retrieval, consider removing this decorator (keep global defaults) or setting a stricter per-route limit; also consider following the existing pattern of relaxing limits under isTest() to avoid test flakiness (see backend/src/entities/user/user.controller.ts:148).

Copilot uses AI. Check for mistakes.
Comment on lines 252 to 256
@UseGuards(TableReadGuard)
@Timeout(TimeoutDefaults.EXTENDED)
@Throttle({ default: { limit: 300, ttl: 60000 } })
@HttpCode(HttpStatus.OK)
@Post('/table/rows/find/:connectionId')
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

This @Throttle({ default: { limit: 300, ttl: 60000 } }) overrides the global throttling defaults (backend/src/app.module.ts:55-62 uses limit: 200, ttl: 60000) and increases the permitted request rate for this route. If the goal is to add/tighten throttling on row retrieval, consider removing the override or choosing a lower per-route limit; optionally match the repo pattern of higher limits in tests via isTest() (e.g., backend/src/entities/company-info/company-info.controller.ts:214).

Copilot uses AI. Check for mistakes.
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