Improve code readability in aggregation processor

This commit is contained in:
Maxime NATUREL 2022-05-25 11:05:28 +02:00
parent b081429725
commit cfdc18d421
1 changed files with 15 additions and 15 deletions

View File

@ -79,11 +79,12 @@ internal class LiveLocationAggregationProcessor @Inject constructor(
}
private fun scheduleDeactivationAfterTimeout(eventId: String, roomId: String, endOfLiveTimestampMillis: Long?) {
endOfLiveTimestampMillis?.let { endOfLiveMillis ->
endOfLiveTimestampMillis ?: return
val workParams = DeactivateLiveLocationShareWorker.Params(sessionId = sessionId, eventId = eventId, roomId = roomId)
val workData = WorkerParamsFactory.toData(workParams)
val workName = DeactivateLiveLocationShareWorker.getWorkName(eventId = eventId, roomId = roomId)
val workDelayMillis = (endOfLiveMillis - clock.epochMillis()).coerceAtLeast(0)
val workDelayMillis = (endOfLiveTimestampMillis - clock.epochMillis()).coerceAtLeast(0)
val workRequest = workManagerProvider.matrixOneTimeWorkRequestBuilder<DeactivateLiveLocationShareWorker>()
.setInitialDelay(workDelayMillis, TimeUnit.MILLISECONDS)
.setInputData(workData)
@ -95,7 +96,6 @@ internal class LiveLocationAggregationProcessor @Inject constructor(
workRequest
)
}
}
private fun cancelDeactivationAfterTimeout(eventId: String, roomId: String) {
val workName = DeactivateLiveLocationShareWorker.getWorkName(eventId = eventId, roomId = roomId)