BatchedRequestQueue

@available(OSX 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)
public final class BatchedRequestQueue<Element>

This class attemmpts to strategically batch send requests and batch retry requests on failures. The main flow of this class looks like:

SUCCESS:

  1. Add event to queue
  2. If threshold met, flush the queue
  3. Flush was successful

FAILURE

  1. Add event to queue
  2. If threshold met, flush the queue
  3. Flush failed
  4. Add items back into items array
  5. Stop processing queue (maintenance mode)
  6. If a healthcheck retrier is not currently waiting, create one and start waiting for a successful healthcheck

HEALTHCHECK SUCCESS

  1. We received a successful healthcheck
  2. Start processing items again (disable maintenance mode)

HEALTHCHECK FAILURE

  1. We received a failed healthcheck, exponential backoff and retry health check