remove maybeMarkActiveCommandFailed. this logic was moved in "updateActiveCommand"

This commit is contained in:
Andrei Vereha 2021-05-31 22:15:39 +02:00
parent a20cc1cca3
commit e867b1397d
2 changed files with 6 additions and 13 deletions

View file

@ -70,7 +70,6 @@ interface OmnipodDashPodStateManager {
fun createActiveCommand(historyId: String): Single<ActiveCommand> fun createActiveCommand(historyId: String): Single<ActiveCommand>
fun updateActiveCommand(): Maybe<CommandConfirmed> fun updateActiveCommand(): Maybe<CommandConfirmed>
fun observeNoActiveCommand(): Observable<PodEvent> fun observeNoActiveCommand(): Observable<PodEvent>
fun maybeMarkActiveCommandFailed()
data class ActiveCommand( data class ActiveCommand(
val sequence: Short, val sequence: Short,

View file

@ -228,16 +228,6 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
} }
} }
@Synchronized
override fun maybeMarkActiveCommandFailed() {
podState.activeCommand?.run {
if (sentRealtime < createdRealtime) {
// command was not sent
podState.activeCommand = null
}
}
}
@Synchronized @Synchronized
override fun updateActiveCommand() = Maybe.create<CommandConfirmed> { source -> override fun updateActiveCommand() = Maybe.create<CommandConfirmed> { source ->
podState.activeCommand?.run { podState.activeCommand?.run {
@ -246,7 +236,11 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
"lastResponse=$lastStatusResponseReceived " + "lastResponse=$lastStatusResponseReceived " +
"$sequenceNumberOfLastProgrammingCommand $historyId" "$sequenceNumberOfLastProgrammingCommand $historyId"
) )
if (createdRealtime >= lastStatusResponseReceived) if (sentRealtime < createdRealtime) {
// command was not sent, clear it up
podState.activeCommand = null
source.onComplete()
} else if (createdRealtime >= lastStatusResponseReceived)
// we did not receive a valid response yet // we did not receive a valid response yet
source.onComplete() source.onComplete()
else { else {