Rate limit draft note creation in DraftNotes::CreateService
What does this MR do and why?
Creating a draft note has no rate limit, so one user can create draft notes as fast as the generic request throttles allow. Publishing drafts already counts against notes_create, so charging draft creation to the same key would count each review comment twice.
This adds a draft_notes_create rate limit, 300 requests per minute for each user by default, and enforces it in DraftNotes::CreateService with RateLimitedService. The REST API and the web endpoint both return 429 Too Many Requests when a user is over the limit. Admins can change the limit in Admin > Settings > Network > Notes rate limits, or with the draft_notes_create_limit application setting. The setup matches discussions_resolve_limit.
References
https://gitlab.com/gitlab-org/gitlab/-/work_items/636471
Screenshots or screen recordings
| Before | After |
|---|---|
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.