-
Notifications
You must be signed in to change notification settings - Fork 545
Implement both retry policy and priorization #99
Comments
For priorization we could implement our custom |
Should the priority order apply to requests across all spice managers within the processor or within each spice manager context avoiding an eager manager from delaying requests from another manager? |
IHMO priority management should be handled by the request processor. |
I agree. It should not be a big deal for an application to manage and define request priorities across it's components. Makes things easier to implement and the effectiveness of the prioritization will increase doing it at the processor level. |
I was thinking, originally, to implement it at both spice manager and I still think that's a good approach as it should not be such a big change @david, I don't see how/why spice manager early ness could be taken into I plan to release RS tomorrow and start working on this feature right away. S.
|
I guess it does not really apply what I said. If done at both levels the spice manager will prioritize the requests within its "scope" and the processor will prioritize the overall requests from many managers. I think that it is a pretty good way to go with regards to this feature. |
Ok, that's fine. If you guys agree, I will try to implement that tomorrow.. We might need beta testers though :) |
Sure! Let me know if you need any help. I might write some test cases for it as well. How are u planning to shape the priority api. On the spice request class? |
On a natural ordering of CachedSpiceRequest + delegation to SpiceRequest. I would define a few constants, I don't like Volley's approach of an enum, 2013/5/19 David Sobreira Marques [email protected]
Stéphane NICOLAS, |
The priorization system has been pushed. I had to dig quite deep into the code of ThreadedPoolExecutor and PriorityBlockingQueue to implement and understand tests. But it works in a predictible way now. There are some inherent limitations to this mechanism. For instance, the first runnable/callable passed to the executor doesn't go in the queue. Thus the priority mechanism will only apply when tasks are queued, and this happens when the number of current runners is exceeds the number of max thread in the pool size. It can look like the implementation is not working, but it actually is and tests work at a rate of 100% (hopefully in CI on a slow emulator as well). This feature gets all its meaning in the case you load A LOT of requests into RoboSpice. For instance, you load images in a listview AND some data from a Pojo. Then you can decide to give a small priority to images, and you will get your Pojo asap. |
I'm glad my idea made sense :) |
Actually that was exactly the way I did it. :) Still, the spice manager's queue should also take priority into account that would limit the impact of the first N < #core priorisation problem. And RetryPolicy + back off alg also remain. |
Those are the only features that Volley offers and RS doesn't (yet).
http://www.youtube.com/watch?v=yhv8l9F44qo
The text was updated successfully, but these errors were encountered: