robospice icon indicating copy to clipboard operation
robospice copied to clipboard

Request with PRIORITY_HIGH is cancelled when SpiceManager.cancel is called before it

Open pouljohn1 opened this issue 10 years ago • 2 comments

I am doing following:

spiceManager.cancel(Results.class, "CacheKey");

MyRequest request = new MyRequest();
request.setPriority(SpiceRequest.PRIORITY_HIGH);
spiceManager.execute(request, "CacheKey", DurationInMillis.ALWAYS_EXPIRED, new MyListener());

In such case MyListener gets onFailure with cancelled description.

As I looked at source it is because spiceManager.cancel() is creating SpiceRequest with PRIORITY_NORMAL. Those two request are rearranged and in such case MyRequest is first and Cancel Request is second. That is causing to MyRequest cancelled.

pouljohn1 avatar Dec 05 '14 12:12 pouljohn1

I am not sure this is really a bug but more a side effect of how things work. What result would you expect ?

stephanenicolas avatar Jan 17 '15 12:01 stephanenicolas

@stephanenicolas I would expect that calling cancel before calling execute would not cancel that request. Similar thing is happening with adding request then listener for that request (I need it in state machine), adding listener also cause to create request. Then it is possible that listener request will be called before our request and in such case listener is not attached and we never get result..

pouljohn1 avatar May 22 '15 14:05 pouljohn1