File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
fetch2/src/main/java/com/tonyodev/fetch2/helper Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ class PriorityListProcessorImpl constructor(private val handlerWrapper: HandlerW
61
61
increaseBackOffTime()
62
62
}
63
63
delegate?.onHasActiveDownloads(priorityList.isNotEmpty())
64
+ var shouldBackOff = true
64
65
for (index in 0 .. priorityList.lastIndex) {
65
66
if (downloadManager.canAccommodateNewDownload() && canContinueToProcess()) {
66
67
val download = priorityList[index]
@@ -75,9 +76,11 @@ class PriorityListProcessorImpl constructor(private val handlerWrapper: HandlerW
75
76
if (! properNetworkConditions) {
76
77
listenerCoordinator.mainListener.onWaitingNetwork(download)
77
78
}
78
- if ((isFetchServerRequest || properNetworkConditions) && ! downloadManager.contains(download.id)
79
- && canContinueToProcess()) {
80
- downloadManager.start(download)
79
+ if ((isFetchServerRequest || properNetworkConditions)) {
80
+ shouldBackOff = false
81
+ if (! downloadManager.contains(download.id) && canContinueToProcess()) {
82
+ downloadManager.start(download)
83
+ }
81
84
}
82
85
} else {
83
86
break
@@ -86,6 +89,9 @@ class PriorityListProcessorImpl constructor(private val handlerWrapper: HandlerW
86
89
break
87
90
}
88
91
}
92
+ if (shouldBackOff) {
93
+ increaseBackOffTime()
94
+ }
89
95
}
90
96
registerPriorityIterator()
91
97
}
You can’t perform that action at this time.
0 commit comments