def add_observer(observer, persistent: true)
      @mutex.synchronize do
        if !@value
          # subscribe for future udpates, no value to return
          @observers[observer] = persistent

        elsif Exception === @value
          # raise with immediate value, no future updates to subscribe to
          raise @value

        elsif persistent
          # return with immediate value, also subscribe for future updates
          @observers[observer] = persistent

        else
          # return with immediate value, do not subscribe for future updates
        end

        return @value
      end
    end
def add_observer(observer, persistent: true)
      @mutex.synchronize do
        if !@value
          # subscribe for future udpates, no value to return
          @observers[observer] = persistent

        elsif Exception === @value
          # raise with immediate value, no future updates to subscribe to
          raise @value

        elsif persistent
          # return with immediate value, also subscribe for future updates
          @observers[observer] = persistent

        else
          # return with immediate value, do not subscribe for future updates
        end

        return @value
      end
    end
Observer is observing this Observable's value.
 Raises if observable has crashed.
 Returns current value, or nil if not yet ready.
 Subscribes observer for updates if persistent, or if not yet ready (returning nil).

 The observer will be dropped once no longer alive?.

 @param observer [Kontena::Observer]
 @param persistent [Boolean] false => either return immediate value, or return nil and subscribe for a single notification
 @raise [Exception]
 @return [Object, nil] current value if ready