Method: Hyperstack::Internal::State::Mapper.run_delayed_updater
- Defined in:
- lib/hyperstack/internal/state/mapper.rb
.run_delayed_updater ⇒ Object
run_delayed_updater will call the mutations method for each observer passing the entire list of objects that changed while waiting for the delay except those that the observer has already seen (the exclusion list). The observers mutation method may cause some other observer already on the observers_to_update list to be removed. To prevent these observers from receiving mutations we keep a temporary set of removed_observers. This is initialized before the mutations, and then cleared as soon as we are done.
244 245 246 247 248 249 250 251 252 253 |
# File 'lib/hyperstack/internal/state/mapper.rb', line 244 def run_delayed_updater current_update_exclusions = @update_exclusions @update_exclusions = @delayed_updater = nil @removed_observers = Set.new observers_to_update(current_update_exclusions).each do |observer, objects| observer.mutations objects unless @removed_observers.include? observer end ensure @removed_observers = nil end |