Skip to content

UID2-7489: route /optout/status through the blocking handler when async batch requests are enabled#2651

Open
sunnywu wants to merge 1 commit into
mainfrom
syw-UID2-7489-optout-status-blocking-handler
Open

UID2-7489: route /optout/status through the blocking handler when async batch requests are enabled#2651
sunnywu wants to merge 1 commit into
mainfrom
syw-UID2-7489-optout-status-blocking-handler

Conversation

@sunnywu

@sunnywu sunnywu commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

/v2/optout/status is a batch endpoint — it accepts up to optout_status_max_request_size (default 5000) advertising IDs per request and looks each up in the opt-out store. However, it was registered with a plain event-loop handler(...) regardless of the enable_async_batch_request flag, unlike the other batch/mapping endpoints:

Endpoint enable_async_batch_request=true =false
key/sharing, key/bidstream, identity/buckets, identity/map (v2/v3) blockingHandler(..., false) (worker pool) handler(...) (event loop)
optout/status (before) handler(...) (event loop) — inconsistent handler(...) (event loop)
optout/status (after) blockingHandler(..., false) (worker pool) handler(...) (event loop)

This PR moves the optout/status registration into the existing isAsyncBatchRequestsEnabled if/else (still guarded by optOutStatusApiEnabled), so it is offloaded to the Vert.x worker pool when async batch requests are enabled — mirroring identity/map.

Why

optout/status has the same "potentially heavy per-request work" profile as identity/map (up to 5000 lookups/request). When async batch offloading is enabled to keep the event loop responsive, this endpoint should be included; leaving it on the event loop undermines the purpose of the flag.

Risk / rollout

Low. With enable_async_batch_request=false (the current default) the behaviour is byte-for-byte identical to before — this is a no-op in current prod config. The worker-pool path only activates under the same flag that already governs the other batch endpoints, and the request/response contract is unchanged; only the executing thread differs. ordered=false matches the sibling endpoints (no cross-request ordering requirement).

Testing

  • Added optOutStatusRequestWithAsyncBatchEnabled — asserts /v2/optout/status still returns a correct success response with enable_async_batch_request=true (i.e. via the blocking handler path).
  • Ran the opt-out status + async-batch tests under JDK 21: 15 run, 0 failures, 0 errors.

Jira: UID2-7489

🤖 Generated with Claude Code

…nc batch requests are enabled

/v2/optout/status is a batch endpoint (accepts up to optout_status_max_request_size,
default 5000, advertising IDs per request) but was registered with a plain event-loop
handler regardless of the enable_async_batch_request flag, unlike the other batch/
mapping endpoints (identity/map, identity/buckets, key/sharing, key/bidstream).

Move its registration into the isAsyncBatchRequestsEnabled if/else, guarded by
optOutStatusApiEnabled, so it uses blockingHandler(..., false) (worker pool, unordered)
when the flag is on and a plain handler when off, mirroring identity/map.

Behaviour is unchanged when enable_async_batch_request is false (the default), so this
is a no-op in current prod config; the worker-pool path only activates under the same
flag that already governs the other batch endpoints. Added a test asserting the endpoint
still succeeds with async batch requests enabled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Ticket: UID2-7489
Branch: syw-UID2-7489-optout-status-blocking-handler
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.

1 participant