Throttle and optimize `/wp-json/optml/v1/optimizations` REST API endpoint execution and validation
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, php, wordpress
- Lĩnh vực
- api, backend, performance
Hướng nghiên cứu
Start by locating the registration of the /wp-json/optml/v1/optimizations REST route and the client script that POSTs the optimization reports. Read the callback for the route to see which mandatory fields are consumed and where heavy profiling or database writes begin, then check the client dispatch path to find where debounce/rate-limit logic belongs. Done means the client sends at most one throttled report per page session and invalid payloads return 400 before any heavy service is initialized; no linked tests or files are named in the issue, so confirm the expected behaviour with a maintainer first.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Impact: 80 · Confidence: 90 · Complexity: 50
Description
Problem
The Optimole frontend script triggers high volumes of POST requests to /wp-json/optml/v1/optimizations (e.g., 500+ requests over 6 hours), with a high percentage (~21%) failing with HTTP 400 Bad Request while still instantiating full WordPress PHP processes and consuming substantial CPU time (e.g. 391 seconds across 525 requests).
Desired Behavior
Optimole should debounce/throttle client-side optimization report payloads, restrict redundant API dispatches, and perform lightweight request validation early in REST API execution to return HTTP 400 responses with minimal PHP processing overhead.
Acceptance Criteria
- Client-side script debounces and rate-limits POST dispatches to
/wp-json/optml/v1/optimizationsper page session. - Server-side REST endpoint performs early validation of mandatory fields before executing heavy profiling logic or database writes.
- High-frequency invalid payloads (HTTP 400) exit early without executing unnecessary internal routines.
Customer Context
A paid subscriber reported server resource exhaustion (391s of PHP processing time across 525 requests in 6 hours; 4,969 requests over 3 days) driven by /wp-json/optml/v1/optimizations, with over 20% returning HTTP 400 bad request errors.
Root Cause Analysis
The customer experiences high PHP usage due to continuous background REST calls to /wp-json/optml/v1/optimizations and wants a way to rate-limit or protect the endpoint. The underlying problem is unthrottled client-side profiler beacons combined with heavyweight processing on invalid payload requests (HTTP 400). Rather than expecting customers to add external rate-limiting rules, Optimole should improve its own beacon frequency, client-side debouncing, and server-side early rejection routines.
Alternative Suggestions
Debounce page profiling network requests on the client side, implement client-side check to skip sending empty/invalid optimization payloads, and add early parameter schema validation on /wp-json/optml/v1/optimizations before initializing heavy services.
Source: HelpScout #3524196151
Generated by feature-request-triage workflow (ID: feature-request-triage_6b0599ff05a6a1.02374250)
- Ngôn ngữ chính
- PHP
- Star
- 74
- Fork
- 14
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 35
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Codeinwp/optimole-wp
-
Lazyload SVG placeholder runs uncached attachment lookups with JSON-escaped URLs on REST responsesĐang mởcustomer report
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Codeinwp/optimole-wp#1253 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
customer report feature-request-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Codeinwp/optimole-wp#1239 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Page profiler never stores above-the-fold background images: `b` is always sent with empty selector mapsCó thể đã có người làm @girishpanchal30 đã nhận 19 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Codeinwp/optimole-wp#1216 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Cache `attachment_url_to_postid()` lookups in `Optml_Lazyload_Replacer` to reduce database overheadĐang mởcustomer report feature-request-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
Codeinwp/optimole-wp#1249 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
customer report feature-request-triage
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Codeinwp/optimole-wp#1231 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Codeinwp/optimole-wp
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
HE-Arc/le-panier-du-coin#49 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
15.0
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
bug: juros do parcelamento travados em 1x no gateway Rede Débito e Crédito 3DS (woo-rede 5.6.0)Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
LinkNacional/woo-rede#367 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Problems with button inputSuffixĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày