Skip to content

Commit

Permalink
ignore first value and use transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreKoepke committed Dec 2, 2024
1 parent 88fe67a commit 11e689e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import ch.akop.homesystem.persistence.repository.config.MotionSensorConfigRepository;
import ch.akop.homesystem.states.NormalState;
import ch.akop.homesystem.states.SleepState;
import io.quarkus.narayana.jta.QuarkusTransaction;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.schedulers.Schedulers;
import io.vertx.core.Vertx;
Expand Down Expand Up @@ -91,8 +92,9 @@ private List<SimpleLight> resolveLights() {

public void startListing() {
stateService.getCurrrentState$()
.skip(1)
.subscribeOn(RxHelper.blockingScheduler(vertx, false))
.subscribe(newState -> this.referencedLights = resolveLights());
.subscribe(newState -> QuarkusTransaction.requiringNew().run(() -> this.referencedLights = resolveLights()));

sensor.getIsMoving$()
.subscribeOn(Schedulers.io())
Expand Down

0 comments on commit 11e689e

Please sign in to comment.