You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Feature Request] - To cancel all the call requests without tracking all in-flight requests and can achieve as volley to set a tag and cancel all requests with the tag.
#2608
Closed
rodent129 opened this issue
Jan 9, 2018
· 1 comment
To cancel retrofit call request, we need to call call.cancel().
But if we have many simultaneous calls request in the background and want to cancel all of them, then we have to track not finishing call requests and calling one by one.
But in volley, you can then use the tag to provide a scope of requests to cancel. For example, you can tag all of your requests with the Activity they are being made on behalf of, and call requestQueue.cancelAll(this) from onStop(). Similarly, you could tag all thumbnail image requests in a ViewPager tab with their respective tabs and cancel on swipe to make sure that the new tab isn't being held up by requests from another one.
Is that possible to do in retrofit 2.0 or is it possible to add a new feature?
Thanks a lot.
The text was updated successfully, but these errors were encountered:
Dupe of #2394. There is not access to OkHttp's tag currently. You might be able to add dummy headers and loop through OkHttp's in-flight Calls and match on them that way though.
To cancel retrofit call request, we need to call call.cancel().
But if we have many simultaneous calls request in the background and want to cancel all of them, then we have to track not finishing call requests and calling one by one.
But in volley, you can then use the tag to provide a scope of requests to cancel. For example, you can tag all of your requests with the Activity they are being made on behalf of, and call requestQueue.cancelAll(this) from onStop(). Similarly, you could tag all thumbnail image requests in a ViewPager tab with their respective tabs and cancel on swipe to make sure that the new tab isn't being held up by requests from another one.
Is that possible to do in retrofit 2.0 or is it possible to add a new feature?
Thanks a lot.
The text was updated successfully, but these errors were encountered: