def doAtLeastOneMore()

in app/lib/Dogpile.scala [49:61]


  def doAtLeastOneMore(): Future[R] = stateRef.updateAndGet { // TODO updateAndGet shouldn't handle side-effects
    previousState =>
    if (previousState.scanFuture.isCompleted) ScanRun(thing) else {
      previousState match {
        case ScanQueued(_) => previousState
        case ScanRun(s) => {
          val p = Promise[R]()
          s.onComplete(_ => p.completeWith(thing))
          ScanQueued(p.future)
        }
      }
    }
  }.scanFuture