atomicState vs. state

Hi all, I'm trying to understand when to use state vs. atomic state. In my case specifically, I'm setting a state variable and then calling a function that acts on said state information.

See below.
Should I be concerned that my state.rooms.put() won't be committed before updateGlobalVars() reads it?

        state.rooms.put( "isOccupiedLastUpdated", new Date().format("YYYY-MM-dd hh:mm:ss a"))
        state.rooms.put( "isOccupied", false)
        state.remove("changeToNotPresentScheduled")
        state.remove("changeToNotPresentTime")
        updateGlobalVars(state.rooms)

State is realtime within the same thread of execution.

atomicState matters if you have parallel thread execution working on the same data.

2 Likes