Skip to content

Commit

Permalink
Rename internal fun.
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed May 25, 2022
1 parent 4f7498d commit 6e86b02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal class SyncRequestStateTracker @Inject constructor() :
private var rootTask: TaskInfo? = null

// Only to be used for incremental sync
fun setStatus(newSyncRequestState: SyncRequestState.IncrementalSyncRequestState) {
fun setSyncRequestState(newSyncRequestState: SyncRequestState.IncrementalSyncRequestState) {
syncRequestState.postValue(newSyncRequestState)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ internal class DefaultSyncTask @Inject constructor(
syncRequestStateTracker.endAll()
} else {
Timber.tag(loggerTag.value).d("Start incremental sync request with since token $token")
syncRequestStateTracker.setStatus(SyncRequestState.IncrementalSyncIdle)
syncRequestStateTracker.setSyncRequestState(SyncRequestState.IncrementalSyncIdle)
val syncResponse = try {
executeRequest(globalErrorReceiver) {
syncAPI.sync(
Expand All @@ -166,7 +166,7 @@ internal class DefaultSyncTask @Inject constructor(
}
} catch (throwable: Throwable) {
Timber.tag(loggerTag.value).e(throwable, "Incremental sync request error")
syncRequestStateTracker.setStatus(SyncRequestState.IncrementalSyncError)
syncRequestStateTracker.setSyncRequestState(SyncRequestState.IncrementalSyncError)
throw throwable
}
val nbRooms = syncResponse.rooms?.invite.orEmpty().size + syncResponse.rooms?.join.orEmpty().size + syncResponse.rooms?.leave.orEmpty().size
Expand All @@ -175,7 +175,7 @@ internal class DefaultSyncTask @Inject constructor(
Timber.tag(loggerTag.value).d(
"Incremental sync request parsing, $nbRooms room(s) $nbToDevice toDevice(s). Got nextBatch: $nextBatch"
)
syncRequestStateTracker.setStatus(
syncRequestStateTracker.setSyncRequestState(
SyncRequestState.IncrementalSyncParsing(
rooms = nbRooms,
toDevice = nbToDevice
Expand All @@ -184,7 +184,7 @@ internal class DefaultSyncTask @Inject constructor(
syncResponseHandler.handleResponse(syncResponse, token, null)
syncResponseToReturn = syncResponse
Timber.tag(loggerTag.value).d("Incremental sync done")
syncRequestStateTracker.setStatus(SyncRequestState.IncrementalSyncDone)
syncRequestStateTracker.setSyncRequestState(SyncRequestState.IncrementalSyncDone)
}
syncStatisticsData.treatmentSyncTime = SystemClock.elapsedRealtime()
syncStatisticsData.nbOfRooms = syncResponseToReturn?.rooms?.join?.size ?: 0
Expand Down

0 comments on commit 6e86b02

Please sign in to comment.