I want to make an NSOperationQueue that pauses a certain length of time between operations. It is hitting a remote server and I want to make sure that I don't overload it with too many operations all at once. I already have set maxConcurrentOperations to 1, so that only one will run at a time.
Asked
Active
Viewed 2,077 times
3
-
1How about interleaving the queue with operations that do nothing but wait for N seconds? – Till Nov 07 '12 at 16:52
-
Will that kill battery life? I plan to run this NSOperationQueue, not on the main thread - will this affect it? – Jason Nov 07 '12 at 16:58
-
1putting a thread to sleep won't affect battery life. You can't ensure your server won't be overloaded via this method, unless you limit distribution of your client application. The server will ultimately be asked to resolve the same net number of queries, making your end users wait seems punitive. – CSmith Nov 07 '12 at 18:44
-
What's the use of the delay when your operations are already executed in serial? – justin Nov 07 '12 at 18:44
1 Answers
1
Check out this post which describes adding a sleep operation between your operations: iPhone - a delay between operations in the queue

Community
- 1
- 1

Edwin Iskandar
- 4,119
- 1
- 23
- 24