Queue Ajax Calls Performantly
Provides a way to queue selected Ajax and REST calls in a considerably more performantly via an MU plugin.
Install in
Reduce server load and increase reliabilty considerably by queuing selected Ajax and REST calls and process them in bulk later on. Load the entire WP system once for every x request.
The mechanism is based on catching the calls early in the WP lifecycle via an MU plugin, santizing and queuing. The queue system is based on Automattic’s own Action Scheduler plugin. The fields for sanitiation should be defined for security reasons.
Processing the calls : the calls are processed in bulk via a hook that is run by CRON.
Who is it for
At this stage the plugin is a developer level plugin and is intended to be used as such. It requires defining fields for sanitation.
However, it comes with a basic implementation for the latest PixelYourSite API calls and can be easily activated without further configuration for most cases.
The flow
- AJAX or REST call evoked in the client browser ->
- MU plugin catches the call if the configuration includes the specific action or route of the call ->
- Processor ( built-in or user defined ) checks the data and sanitizes it ->
- Data is stored in DB to be handled in queue. The data includes the call’s data and cookies ->
- Data is processed in batch via a recurring Action Scheduler hook. The processing is done via the same “Processor”.
- A row is completed only when its processor returns true. Failed rows retry with backoff and then remain visible for manual recovery.
Queue reliability
Queue rows move through pending, processing, completed, retry, failed, and cancelled states. Rows are claimed atomically one at a time so concurrent runners cannot process the same call. A PHP process that terminates unexpectedly leaves only its active row locked; stale locks are recovered automatically and later calls continue to advance.
The settings page shows queue totals grouped by AJAX/REST request and action. Failed rows can be retried, cancelled, or deleted without direct database access.
Anonymized endpoint diagnostics
When an endpoint request fails validation, the settings page can capture an anonymized diagnostic report. Start capture, reproduce the rejected request, and then use Copy debug report. Capture stops after the first validation failure or after ten minutes.
The report includes environment and processor configuration, the validation reason, and request field names, types, and sizes. It does not include request values, cookies, URLs, domains, IP addresses, user IDs, event IDs, nonces, or authorization data.
Replay processors
The admin Replay Processors builder supports sanitation-only integrations. Define an AJAX action or REST route, validation policy, and allowed parameter types. QACP then validates the captured request and internally replays its original WordPress handler during queue processing. Custom PHP processors remain available when an integration needs specialized processing logic.
Basic terminogoly
Processor : A class/instance that is used to define the data map of fields for sanitation and later on, for batch processing. In many cases, the Processor will be quite simple. Please check the built-in Processor class “class-pys.php” under the “qacp/Processors” directory.
Data Map : The map of fields and their respectable sanitation functions. There’s an example in the “qacp/qacp-how-to.txt” file.
REST route key : A configured REST route prefixed with “rest:”, for example “rest:pys-facebook/v1/event”.
Things to Remember
- The Processor should define clearly what are the received fields and their sanitation functions.
- The action and processor should be registerd. There’s an example in the “qacp/qacp-how-to.txt” file.
- A Processor must return true after successful processing. False, WP_Error, and exceptions are treated as failures.
Hooks
- qacp/processors/active_processors
- qacp/processors/actions
- qacp/processors/identify_processor
-
qacp/processors/instance_by_action_name
-
qacp_before_batch_processing
- qacp_before_process_entry_{$_action_name}
- qacp_before_process_entry
- qacp_process_one_entry_{$_action_name}
- qacp_process_one_entry
- qacp_mark_event_finished
- qacp_after_process_entry_{$_action_name
- qacp_after_process_entry
- qacp_after_batch_processing
Written by Joobi from the project's own listing. See the source page
1.1.33
- Add a configurable backup and cleanup interval, defaulting to 60 minutes. Process all eligible records in batches and remove routine table optimization.
- Preserve completed and cancelled counts by request during cleanup. Show the number of completed rows still stored separately from the cumulative total.
1.1.32
- Show SQL, deleted row count, elapsed time and database errors after manual completed-queue cleanup.
1.1.31
- Add Store cookies with queued requests in Settings, enabled by default for compatibility. When disabled, new AJAX/REST entries contain an empty cookie collection without altering live request cookies or authentication.
- Retain compatibility with previously queued payloads and include the preference in value-free support exports. Existing queue entries, backups, user IDs and allowed request parameters are unchanged.
1.1.30
- Limit discovery, inspection, counters, schema-change views, Testing and Benchmarks to POST requests. Retain old non-POST history for support and leave queue processing unchanged.
- Add persistent per-request hiding with a collapsed Hidden requests list and Restore request controls. Hidden keys bypass all monitoring writes and visible inventory limits without deleting historical data, schemas or queue settings.
1.1.29
- Count affected requests whenever enabled-route schema-change monitoring is active, separately from actual capture-validation failures. Retain the optional all-visitor timed recorder without double-counting overlapping modes.
- Show persistent live results, explicit recording states and first/last UTC observations in Testing, with a summary and View results above tabs. Keep category clearing, schema-warning dismissal and benchmark clearing independent.
- Upgrade aggregate storage without dropping existing counts, retain unknown dates on old records, and include counter dates in support exports. Stop capture now also stops automatic schema-change monitoring.
1.1.28
- Discover WooCommerce wc-ajax query endpoints with request counts, selected parameter inspection and regular lifecycle timings, respecting guest/logged-in audience filters and monitoring durations.
- Mark WooCommerce AJAX observation-only and prevent queue capture. Add safe schema-only dry tests without executing checkout or payment handlers; exclude query routing metadata from observed parameters.
1.1.27
- Keep the Validation fallbacks panel visible above the tabs after recording expires, including when no counts exist. Show recording status and an explicit empty state; retain refresh access and saved counts.
1.1.26
- Add off-by-default, time-limited live validation-fallback recording in Testing. Count AJAX/REST request keys and methods without request values; show cumulative counts above the tabs with refresh and clear controls.
- Keep counters independent from benchmark sampling/clearing and preserve normal lifecycle fallback even when counter storage fails. Include recording settings in support exports; no new database schema is required.
1.1.25
- Fall back to the regular WordPress lifecycle when QACP’s capture validation fails, instead of terminating with request validation error. The original AJAX/REST handler retains its own permission, nonce and payload checks.
- Restore original POST, GET and REQUEST globals before fallback; preserve successful early capture and isolated diagnostic test behavior. Optional diagnostic failures do not block normal handling.
- Measure fallback traffic as regular lifecycle requests, not as requests rejected by QACP. This release does not change the disabled-route background processor lookup issue.
1.1.24
- Standardize single-line admin input and select heights, and center button labels and icons. Retain native checkbox/radio sizes, multiline textareas and hidden controls; use larger control heights on mobile.
1.1.23
- Show queue statistics and recovery controls above the admin tabs so they remain visible in every view. Keep configuration and processor controls in Settings, which remains the default tab.
1.1.22
- Expand administrator support exports with bounded per-record queue diagnostics: method, attempts, timestamps, coded errors and current worker registry/result-awareness checks, excluding request values and raw errors.
- Record catcher version and processor class on new captures; label unavailable historical versions as unknown. Report installed header and loaded MU versions separately from runtime plugin and historical records.
- Preserve queue processing behavior and existing records; no automatic retries, deletion or schema changes are performed by diagnostic export.
1.1.21
- Respect known processor methods in early capture, request queue controls and schema-change reporting. PixelYourSite REST GET no longer mirrors POST queue selection or generates misleading missing-required warnings. Preserve unknown custom-processor behavior and method-specific inspection.
- Align REST monitoring with capture input so query-only routing artefacts are not reported as POST body fields. Hide historical differences for unsupported methods without deleting support evidence.
- Add optional UTM fields and a 2048-byte schemeless event URL text limit to PixelYourSite REST defaults. Preserve approved overrides and document required processor defaults and manual override adjustments.
1.1.20
- Add an administrator-only support JSON export of recorded metadata, schemas, processor settings and aggregate queue/benchmark statistics, excluding request values, payloads and raw errors.
- Distinguish historical schema differences from each parameter’s current Required, Optional or Unconfigured rule. Document missing-required semantics and retained history.
- Record query/body origin and first-observed time for new schema differences without repeatedly rewriting unchanged observations.
1.1.19
- Make Settings the first and default admin tab, merging general queue statistics and recovery controls into the same view without removing settings or processor controls.
- Preserve existing request/testing/benchmark links and redirect former Queue-tab links to the combined Settings view.
1.1.18
- Compare regular and optimized AJAX/REST request times side by side, with sample counts, ranges, saved milliseconds and percentage reduction. Exclude background queue processing and failed requests from successful comparisons.
- Refresh benchmarks when opening the tab and add a Refresh button, active-session status and timing-storage errors instead of silently showing an empty table.
- Retain the first sample per request, method and mode before applying the percentage sampler. Arm timing independently of parameter inspection, finish optimized capture before response/shutdown, and measure regular calls at the start of WordPress shutdown with a guarded PHP fallback.
1.1.17
- Bring the request schema editor into view after Configure. Review focuses the affected observed or approved parameter instead of only switching tabs.
- Show schema loading and failures prominently, hide stale editors on failed loads, and retain schema-save confirmation. Add browser regression coverage for long request lists and failed detail requests.
1.1.16
- Add cumulative per-request-key and method counters to Requests. Count matching traffic during discovery or selected parameter inspection with atomic increments, respecting visitor filters. Counters pause outside these sessions; earlier traffic is not backfilled.
- Upgrade the inventory table automatically without losing existing schemas or changes. Exact counting requires one counter update per observed request; unchanged schema metadata still avoids updates.
1.1.15
- Add Requests, Schema Changes, Testing and Benchmarks admin tabs while retaining queue controls and settings.
- Add bounded, timed or continuous request discovery, manual request keys, visitor filters and selective parameter inspection. Deduplicate metadata and schema changes; unchanged observations do not write new records.
- Add approved nested sanitation schemas for enabled or disabled request keys, reviewed processor drafts and administrator-authorized guest/logged-in dry tests with JSON or form encoding.
- Fix recursive sanitation to apply array_fields to each object in a list, preserve inherited array sanitation and bound nested structures. Generic replay validation now checks nested required fields, structures, numeric types, limits and unknown fields.
- Preserve raw quotes and backslashes during early MU parsing, initialize nonce authentication before captured-request validation, and defer visitor-filter authentication on ordinary requests until plugins have loaded. Support same-host PixelYourSite testing on local ports.
- Add sampled regular, optimized-capture, rejected-request and background-processing timings with counts, means, minimums, maximums and errors. Create separate inventory and timing tables automatically on upgrade.
1.1.14
- Added screenshots
1.1.13
- Add a Tests section with a guest-request button, editable sample text, HTTP and validation results, and copyable diagnostics.
- Send the test from the browser without cookies or login credentials, authorized by a short-lived, single-use token issued only to administrators.
- Exercise a dedicated MU test endpoint, the configured PixelYourSite REST validator, and the shared queue writer. Verify and remove an inert cancelled test row without sending tracking events.
- Report configuration, validation, storage, cleanup and request errors. This test does not verify scheduled queue processing or delivery to Meta.
1.1.12
- Fix the WooCommerce HPOS compatibility declaration to reference the main qacp.php plugin file instead of class-qacp.php, resolving the FeaturesController “Invalid plugin file” log message.
1.1.11
- Verify installed MU catcher contents during normal plugin startup and repair stale, missing, or relocated copies, even when the version number has not changed.
- Replace the MU file through a verified temporary file instead of deleting the working file first. Retry failed updates without recording a successful version upgrade.
- Request OPcache invalidation after replacement and on activation, version upgrades, and diagnostic capture startup.
- Fix activation and deactivation hook paths on Linux servers.
- Add an admin notice for failed MU updates and anonymized MU file verification and cache invalidation results to debug reports.
1.1.10
- Fix the MU catcher skipping AJAX and REST requests when installed under the WordPress repository directory name. Detect the active plugin using its actual installation path instead of hardcoding qacp/qacp.php.
- Recognize network activation when checking whether the MU catcher should run.
- Refresh the installed MU catcher on upgrade through the existing version update mechanism.
1.1.9
- Repackage the complete plugin after the initial WordPress repository 1.1.8 download omitted 16 PHP files.
- Include missing Action Scheduler classes, including ActionScheduler_RecurringActionScheduler, whose absence caused a fatal error during WordPress startup.
- Include the PixelYourSite REST and generic replay processors missing from that download.
- Issue a new version so sites running the incomplete 1.1.8 package receive the repair through the normal WordPress update process. No queue processing behavior changes from the complete 1.1.8 release.
Follow this listing's changes (Atom feed)