Code Monkey home page Code Monkey logo

monix.io's Issues

Improve 2.x documentation redirection

If we google Monix docs, e.g. monix task parallelism the first results are Monix 2.x
We get a notification to go to latest docs but if we click there we are redirected to its main page.

Would be cool if we could redirect directly to specific section (in this case parallelism) when possible instead of main page.

Improve documentation for 3.x

Some documentations are unclear - the most noticeable are the missing usages of the word "the", and in general others are unclear in the way the sentence is constructed.

Docs for making repeated requests with Observable

Copied from gitter... Thanks @alexandru

@theamytran for repeated HTTP requests, it’s a very simple job, you can simply do …

// Continuous
Observable.repeat(()).mapFuture(_ => createFuture())
// Request every 1 second
Observable.interval(1.second).mapFuture(_ => createFuture())

Observable.repeat(()).mapTask(_ => createTask())
// Request every 1 second
Observable.interval(1.second).mapTask(_ => createTask())

// There’s also good-old flatMap / concatMap
Observable.interval(1.second).concatMap(_ => Observable.fromTask(myTask))
Observable.interval(1.second).concatMap(_ => Observable.fromFuture(myFuture()))

Note there's intervalWithFixedDelay and intervalAtFixedRate. And these operators, along with these mapFuture, mapTask, concatMap, mapAsync are applying back-pressure, so you won’t have multiple requests running in parallel, unless you want it (see mapAsync(paralellism=4))
@theamytran @a-reisberg when publishing into a PublishSubject, note that their back-pressure contract needs to be respected and that back-pressure contract also implies doing synchronization, in case you want to call onNext from multiple sources / threads. If you don’t want to deal with back-pressure or with concurency, one needs to use a ConcurrentSubject.publish instead, which place a concurrent buffer in front.
@theamytran if you don’t have a buffer (e.g. ConcurrentSubject, Pipe.multicast or Observable.create) and want to push straight into a simple Observer / Subscriber / Subject, then the back-pressure must be upholded. See the docs on that: https://monix.io/docs/2x/reactive/observers.html#feeding-an-observer

Compilation problem in example code (Consumer chapter, Introduction section)

Hi!

I was reading Monix docs (great work btw), and I think I've found a small bug in the example code. In the 'Consumer' chapter, 'Introduction' section we have:

val sumConsumer = Consumer.foldLeft[Long,Long](Coeval(0L))(_ + _)

But the compiler complains:

[error]  found   : monix.eval.Coeval[Long]
[error]  required: Long
[error]   val sumConsumer: Consumer[Long,Long] = Consumer.foldLeft[Long,Long](Coeval(0L))(_ + _

Replacing Coeval(0L) with just 0L solves the problem:

val sumConsumer = Consumer.foldLeft[Long,Long](0L)(_ + _)

Hope it helps! And contragulations for your great work :)

ScalaFiddle example in 'Javascript Event Listeners' requires adding Monix library

Hi,

In the Javascript Event Listeners chapter there is a link to an example in ScalaFiddle. Unfortunately when visiting the page the example does not compile because the Monix library is not included automatically. The user can solve the problem by including the library manually.

I think that if the author of the ScalaFiddle page (@alexandru I believe) adds the library then users visiting the page will have it loaded automatically (I did that in a fork of the ScalaFiddle example that seems to run ok without any user intervention).

Best,

Documentation TODO for 3.x

I hope this is OK, but I wanted to capture task ideas from @alexandru and @Avasil in #28 (comment) in a more visible place and also add a checklist.

  • Observable
  • Iterant (lots of documentation in Scaladocs)
  • Scheduler
    • clockRealtime / clockMonotonic
    • TracingScheduler
  • new Task features:
    • cancelable
    • uncancelable
    • onCancelRaiseError
    • bracket
    • start + cancel + Fiber
    • racePair
    • onErrorRestartLoop
  • TaskLocal
  • cats-effect integration
    • Timer

Use compile-only checking

We can use mdoc:compile-only for code snippets. This should speed up the building of the site.

I see no reason for generating output, because it's slow and I've never seen the need for it, other than for simulating repl sessions, but those are awkward when copy/pasting, as you're copy/pasting the output as well. If we need output, we can add it manually in comments. If we need types, we can add them explicitly.

See scalameta/mdoc#366

Inconsistency w.r.t Task#executeOn() documentation

When try out the code on https://github.com/monix/monix.io/blame/master/_docs/3x/eval/task.md#L599-L639 I see no difference between the two case with or without the asyncBoundary call.

In other words, it seems that now only the forked Task runs in the Scheduler.io() and the onFinish reverts to a thread from the default Scheduler.

Here's what I'm seeing in Ammonite:

@ val cancelable = {
    source.flatMap(_ => forked)
      .doOnFinish(_ => onFinish)
      .runToFuture
  }
Running on thread: main
Running on thread: my-io-592
Ends on thread: scala-execution-context-global-485
cancelable: monix.execution.CancelableFuture[Unit] = Async(Future(Success(())), monix.eval.internal.TaskConnection$Impl$$anon$1@1a799c73)

 @ val cancelable = {
    source.flatMap(_ => forked)
      .asyncBoundary
      .doOnFinish(_ => onFinish)
      .runToFuture
  }
Running on thread: main
Running on thread: my-io-592
Ends on thread: scala-execution-context-global-485
cancelable: monix.execution.CancelableFuture[Unit] = Async(Future(<not completed>), monix.eval.internal.TaskConnection$Impl$$anon$1@2d3c799e)


Is there something I'm missing? Or has there been a change in behavior since this was written?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.