Improve code readability in aggregation processor
This commit is contained in:
parent
b081429725
commit
cfdc18d421
|
@ -79,22 +79,22 @@ internal class LiveLocationAggregationProcessor @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun scheduleDeactivationAfterTimeout(eventId: String, roomId: String, endOfLiveTimestampMillis: Long?) {
|
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 workRequest = workManagerProvider.matrixOneTimeWorkRequestBuilder<DeactivateLiveLocationShareWorker>()
|
|
||||||
.setInitialDelay(workDelayMillis, TimeUnit.MILLISECONDS)
|
|
||||||
.setInputData(workData)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
workManagerProvider.workManager.enqueueUniqueWork(
|
val workParams = DeactivateLiveLocationShareWorker.Params(sessionId = sessionId, eventId = eventId, roomId = roomId)
|
||||||
workName,
|
val workData = WorkerParamsFactory.toData(workParams)
|
||||||
ExistingWorkPolicy.KEEP,
|
val workName = DeactivateLiveLocationShareWorker.getWorkName(eventId = eventId, roomId = roomId)
|
||||||
workRequest
|
val workDelayMillis = (endOfLiveTimestampMillis - clock.epochMillis()).coerceAtLeast(0)
|
||||||
)
|
val workRequest = workManagerProvider.matrixOneTimeWorkRequestBuilder<DeactivateLiveLocationShareWorker>()
|
||||||
}
|
.setInitialDelay(workDelayMillis, TimeUnit.MILLISECONDS)
|
||||||
|
.setInputData(workData)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
workManagerProvider.workManager.enqueueUniqueWork(
|
||||||
|
workName,
|
||||||
|
ExistingWorkPolicy.KEEP,
|
||||||
|
workRequest
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun cancelDeactivationAfterTimeout(eventId: String, roomId: String) {
|
private fun cancelDeactivationAfterTimeout(eventId: String, roomId: String) {
|
||||||
|
|
Loading…
Reference in New Issue