limit EventProfileSwitchChanged processing

This commit is contained in:
Milos Kozak 2022-07-18 13:35:03 +02:00
parent 07abc0f2b6
commit 49421da1d6

View file

@ -46,6 +46,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import io.reactivex.rxjava3.kotlin.subscribeBy
import java.util.*
import java.util.concurrent.TimeUnit
import javax.inject.Inject
import javax.inject.Singleton
@ -81,6 +82,7 @@ class CommandQueueImplementation @Inject constructor(
disposable += rxBus
.toObservable(EventProfileSwitchChanged::class.java)
.observeOn(aapsSchedulers.io)
.throttleLatest(3L, TimeUnit.SECONDS)
.subscribe({
if (config.NSCLIENT) { // Effective profileswitch should be synced over NS, do not create EffectiveProfileSwitch here
return@subscribe