提交 0a44cf60 编写于 作者: T Tolriq 提交者: Sam

Ensure that restarted request use the updated model when failed/canceled as it...

Ensure that restarted request use the updated model when failed/canceled as it can contains data to help the request to succeed. (#2293)
上级 9e9ce00e
......@@ -359,11 +359,15 @@ public class RequestBuilder<TranscodeType> implements Cloneable {
Request request = buildRequest(target);
Request previous = target.getRequest();
if (request.isEquivalentTo(previous)) {
// When request was failed or cancelled, be sure to use the updated model as it can contains
// unexposed data that could help the request to succeed on restart.
// See https://github.com/bumptech/glide/issues/2270
if (request.isEquivalentTo(previous)
&& (Preconditions.checkNotNull(previous).isComplete()
|| Preconditions.checkNotNull(previous).isRunning())) {
request.recycle();
// If the request is completed, beginning again will ensure the result is re-delivered,
// triggering RequestListeners and Targets. If the request is failed, beginning again will
// restart the request, giving it another chance to complete. If the request is already
// triggering RequestListeners and Targets. If the request is already
// running, we can let it continue running without interruption.
if (!Preconditions.checkNotNull(previous).isRunning()) {
previous.begin();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册