Repository navigation
Open
Labels
enhancementNew feature or request
Description
Problem
Client::sendPreparedEvent() sends one request per pixel, in order, and throws at the first pixel that fails: a ResponseException when Meta answers anything but a 200, a TransportException when the HTTP client fails. The pixels after the failing one are never attempted.
Take an event with pixels A, B and C, where B's access token has expired:
- A is sent and succeeds.
- B is sent, Meta answers 400, and the client throws.
- C is never attempted, even though nothing is wrong with C.
Consequences:
- C loses the conversion because of B's problem. This is the same "one pixel blocks the others" situation that Skip pixels without an access token instead of rejecting the whole event #19 fixed for pixels without an access token, only caused by Meta's answer instead of a missing token.
- In a queue it gets worse. If the handler retries, A receives the event again, B fails again, and C is still never reached, until someone fixes B. If the handler gives up instead, C's conversion is lost for good.
- The exception does not tell the whole story. It says nothing about A having succeeded or C having been skipped, so the caller cannot react sensibly.
The current behaviour is pinned on purpose by ClientTest::it_stops_at_the_first_pixel_that_gets_an_unsuccessful_response.
Direction
Treat the pixels as independent destinations: attempt every pixel, remember which ones failed and why, and throw once at the end.
Things that need deciding:
- A new exception that holds several failures, e.g. one
ResponseException/TransportExceptionper failed pixel, keyed by pixel id. It should implementExceptionInterfacelike everything else. What does it extend, and what is its own message? - What it reports about the pixels that succeeded, so that a caller knows what was delivered.
- A clean way to retry only the failed pixels. Probably a
PreparedEventnarrowed to those pixels, either built by the exception or through something likePreparedEvent::withPixels(). - Whether a retry decision can be made per pixel. A transient 5xx for one pixel and an expired token for another call for different handling.
- A single failing pixel. Should an event with one pixel still throw the plain
ResponseException/TransportException, or always the new exception?
Notes
- Belongs on
2.x: it changes which exception is thrown and when, and 2.0 is where the exception model was redone (Replace ClientException with three exceptions behind one ExceptionInterface #18). - Meta deduplicates on
event_idandevent_name, which softens the "A receives the event again" part, but it does nothing for C.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity