Hi,
I'm experiencing intermittent delays with URLSession where requests take 3-4 seconds to be sent, even though the actual server processing is fast. This happens randomly, maybe 10-20% of requests.
The pattern I've noticed is
- I create my request
- I send off my request using
try await urlSession.data(for: request) - My middleware ends up receiving this request 4-7s after its been fired from the client-side
- The round trip ends up taking 4-7s!
This hasn't been reproducible consistently at all on my end. I've also tried ephemeral URLSessions (so recreating the session instead of using .shared so no dead connections, but this doesn't seem to help at all)
Completely lost on what to do. Please help!