Re: Doing request rate limiting with NSURLSession
Re: Doing request rate limiting with NSURLSession
- Subject: Re: Doing request rate limiting with NSURLSession
- From: Sebastien Boisvert <email@hidden>
- Date: Fri, 22 Feb 2019 16:56:12 -0500
That's more-or-less what we ended up doing, but implemented it as a custom
NSURLProtocol that can be used by a session's configuration (so it can be used
with any session, or subclassed to handle specific endpoints, etc.). When using
it one thing to keep in mind was to ensure the timeout for the session (or the
tasks themselves) was long enough so they didn't get cancelled before the
protocol got to handling them.
> On Oct 10, 2018, at 1:37 PM, Jens Alfke <email@hidden> wrote:
>
> You can queue the requests yourself in an NSMutableArray or something. Then
> issue the first one. When the task's delegate’s didSendBodyData: method is
> called, schedule starting the next request (either immediately or after a
> delay of ≤ 1/32 sec.)
>
> This is a bit conservative because that delegate method won’t be called until
> some time after the HTTP request is sent, but it should keep you from getting
> errors.
>
> —Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden