iniyanp
3/10/2017 - 12:54 AM

why it s not working?

why it s not working?


    //Why awakeEvery is not waking up in everyDuration when I attach it to the Sink.
    val p5:Process[Task,Int] = Process.eval(Task.now(scala.util.Random.nextInt()))
    val p6 = p5 ++ time.awakeEvery(FiniteDuration(250, TimeUnit.MILLISECONDS)).flatMap(_ => p5)
    val func:Int => Task[Unit] = s => Task.delay{
      println(s + ".....YAY")
    }
    val sink:Sink[Task, Int] = Process.eval(Task.delay(func))
    val p7 = p6 to sink
    p7.run.run
    
    because what you have is just one function in a stream, what we need is infinite stream.
    
    so if we change our sink to this. Process.constant(func). then it works fine. :)