From fcf7faa3e05daf9c408821de1677ca1a6b6d7ab1 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 14 Jun 2021 15:52:43 +0200 Subject: [PATCH] queue independentConnect fix for DanaR pumps --- .../info/nightscout/androidaps/queue/CommandQueue.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt index 10c0f8e983..2ade4058f4 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.kt @@ -68,12 +68,12 @@ open class CommandQueue @Inject constructor( private val disposable = CompositeDisposable() private val queue = LinkedList() - private var thread: QueueThread? = null + @Volatile private var thread: QueueThread? = null - var performing: Command? = null + @Volatile var performing: Command? = null init { - disposable.add(rxBus + disposable += rxBus .toObservable(EventProfileSwitchChanged::class.java) .observeOn(aapsSchedulers.io) .subscribe({ @@ -109,8 +109,6 @@ open class CommandQueue @Inject constructor( }) } }, fabricPrivacy::logException) - ) - } private fun executingNowError(): PumpEnactResult = @@ -197,6 +195,7 @@ open class CommandQueue @Inject constructor( aapsLogger.debug(LTag.PUMPQUEUE, "Starting new queue") val tempCommandQueue = CommandQueue(injector, aapsLogger, rxBus, aapsSchedulers, resourceHelper, constraintChecker, profileFunction, activePlugin, context, sp, buildHelper, dateUtil, repository, fabricPrivacy) tempCommandQueue.readStatus(reason, callback) + tempCommandQueue.disposable.clear() } @Synchronized