Sending queue : rename const for more clarity.

This commit is contained in:
ganfra 2024-06-13 13:03:04 +02:00
parent 6d4d9db8a1
commit a1aac5578c
2 changed files with 7 additions and 7 deletions

View file

@ -31,7 +31,7 @@ import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
@VisibleForTesting @VisibleForTesting
const val SENDING_QUEUE_RETRY_DELAY = 1500L const val SEND_QUEUES_RETRY_DELAY_MILLIS = 1500L
@SingleIn(SessionScope::class) @SingleIn(SessionScope::class)
class SendQueues @Inject constructor( class SendQueues @Inject constructor(
@ -49,7 +49,7 @@ class SendQueues @Inject constructor(
.onEach { roomId: RoomId -> .onEach { roomId: RoomId ->
Timber.d("Send queue disabled for room $roomId") Timber.d("Send queue disabled for room $roomId")
if (networkMonitor.connectivity.value == NetworkStatus.Online) { if (networkMonitor.connectivity.value == NetworkStatus.Online) {
delay(SENDING_QUEUE_RETRY_DELAY) delay(SEND_QUEUES_RETRY_DELAY_MILLIS)
matrixClient.getRoom(roomId)?.use { room -> matrixClient.getRoom(roomId)?.use { room ->
room.setSendQueueEnabled(enabled = true) room.setSendQueueEnabled(enabled = true)
} }

View file

@ -51,7 +51,7 @@ import org.junit.Test
sut.launchIn(backgroundScope) sut.launchIn(backgroundScope)
sendQueueDisabledFlow.emit(room.roomId) sendQueueDisabledFlow.emit(room.roomId)
advanceTimeBy(SENDING_QUEUE_RETRY_DELAY) advanceTimeBy(SEND_QUEUES_RETRY_DELAY_MILLIS)
runCurrent() runCurrent()
assert(setAllSendQueuesEnabledLambda) assert(setAllSendQueuesEnabledLambda)
@ -79,7 +79,7 @@ import org.junit.Test
sut.launchIn(backgroundScope) sut.launchIn(backgroundScope)
sendQueueDisabledFlow.emit(room.roomId) sendQueueDisabledFlow.emit(room.roomId)
advanceTimeBy(SENDING_QUEUE_RETRY_DELAY) advanceTimeBy(SEND_QUEUES_RETRY_DELAY_MILLIS)
runCurrent() runCurrent()
assert(setAllSendQueuesEnabledLambda) assert(setAllSendQueuesEnabledLambda)
@ -96,11 +96,11 @@ import org.junit.Test
matrixClient.setAllSendQueuesEnabledLambda = setEnableSendingQueueLambda matrixClient.setAllSendQueuesEnabledLambda = setEnableSendingQueueLambda
sut.launchIn(backgroundScope) sut.launchIn(backgroundScope)
advanceTimeBy(SENDING_QUEUE_RETRY_DELAY) advanceTimeBy(SEND_QUEUES_RETRY_DELAY_MILLIS)
networkMonitor.connectivity.value = NetworkStatus.Offline networkMonitor.connectivity.value = NetworkStatus.Offline
advanceTimeBy(SENDING_QUEUE_RETRY_DELAY) advanceTimeBy(SEND_QUEUES_RETRY_DELAY_MILLIS)
networkMonitor.connectivity.value = NetworkStatus.Online networkMonitor.connectivity.value = NetworkStatus.Online
advanceTimeBy(SENDING_QUEUE_RETRY_DELAY) advanceTimeBy(SEND_QUEUES_RETRY_DELAY_MILLIS)
assert(setEnableSendingQueueLambda) assert(setEnableSendingQueueLambda)
.isCalledExactly(3) .isCalledExactly(3)