Timeline: don't retry automatically to avoid totally blocking pagination
This commit is contained in:
parent
7697278bb2
commit
c8f0c83cd3
|
@ -504,7 +504,6 @@ internal class DefaultTimeline(
|
||||||
Timber.v("Should fetch $limit items $direction")
|
Timber.v("Should fetch $limit items $direction")
|
||||||
cancelableBag += paginationTask
|
cancelableBag += paginationTask
|
||||||
.configureWith(params) {
|
.configureWith(params) {
|
||||||
this.retryCount = Int.MAX_VALUE
|
|
||||||
this.constraints = TaskConstraints(connectedToNetwork = true)
|
this.constraints = TaskConstraints(connectedToNetwork = true)
|
||||||
this.callback = object : MatrixCallback<TokenChunkEventPersistor.Result> {
|
this.callback = object : MatrixCallback<TokenChunkEventPersistor.Result> {
|
||||||
override fun onSuccess(data: TokenChunkEventPersistor.Result) {
|
override fun onSuccess(data: TokenChunkEventPersistor.Result) {
|
||||||
|
@ -524,6 +523,8 @@ internal class DefaultTimeline(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(failure: Throwable) {
|
override fun onFailure(failure: Throwable) {
|
||||||
|
updateState(direction) { it.copy(isPaginating = false, requestedPaginationCount = 0) }
|
||||||
|
postSnapshot()
|
||||||
Timber.v("Failure fetching $limit items $direction from pagination request")
|
Timber.v("Failure fetching $limit items $direction from pagination request")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,7 +220,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
|
||||||
showingForwardLoader = LoadingItem_()
|
showingForwardLoader = LoadingItem_()
|
||||||
.id("forward_loading_item_$timestamp")
|
.id("forward_loading_item_$timestamp")
|
||||||
.setVisibilityStateChangedListener(Timeline.Direction.FORWARDS)
|
.setVisibilityStateChangedListener(Timeline.Direction.FORWARDS)
|
||||||
.addWhen(Timeline.Direction.FORWARDS)
|
.addWhenLoading(Timeline.Direction.FORWARDS)
|
||||||
|
|
||||||
val timelineModels = getModels()
|
val timelineModels = getModels()
|
||||||
add(timelineModels)
|
add(timelineModels)
|
||||||
|
@ -230,7 +230,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
|
||||||
LoadingItem_()
|
LoadingItem_()
|
||||||
.id("backward_loading_item_$timestamp")
|
.id("backward_loading_item_$timestamp")
|
||||||
.setVisibilityStateChangedListener(Timeline.Direction.BACKWARDS)
|
.setVisibilityStateChangedListener(Timeline.Direction.BACKWARDS)
|
||||||
.addWhen(Timeline.Direction.BACKWARDS)
|
.addWhenLoading(Timeline.Direction.BACKWARDS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,6 +247,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
|
||||||
currentSnapshot = newSnapshot
|
currentSnapshot = newSnapshot
|
||||||
val diffResult = DiffUtil.calculateDiff(diffCallback)
|
val diffResult = DiffUtil.calculateDiff(diffCallback)
|
||||||
diffResult.dispatchUpdatesTo(listUpdateCallback)
|
diffResult.dispatchUpdatesTo(listUpdateCallback)
|
||||||
|
requestDelayedModelBuild(100)
|
||||||
inSubmitList = false
|
inSubmitList = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,7 +320,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
|
||||||
/**
|
/**
|
||||||
* Return true if added
|
* Return true if added
|
||||||
*/
|
*/
|
||||||
private fun LoadingItem_.addWhen(direction: Timeline.Direction): Boolean {
|
private fun LoadingItem_.addWhenLoading(direction: Timeline.Direction): Boolean {
|
||||||
val shouldAdd = timeline?.hasMoreToLoad(direction) ?: false
|
val shouldAdd = timeline?.hasMoreToLoad(direction) ?: false
|
||||||
addIf(shouldAdd, this@TimelineEventController)
|
addIf(shouldAdd, this@TimelineEventController)
|
||||||
return shouldAdd
|
return shouldAdd
|
||||||
|
|
Loading…
Reference in New Issue