monix / monix.io Goto Github PK
View Code? Open in Web Editor NEWThe documentation website.
Home Page: https://monix.io
License: Other
The documentation website.
Home Page: https://monix.io
License: Other
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.
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.
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
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 :)
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,
Many of the links have this format "https://monix.io/api/2.3/#monix.reactive.Observer" which only works with the previous version of the api docs.
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.
Iterant
(lots of documentation in Scaladocs)Scheduler
clockRealtime
/ clockMonotonic
TracingScheduler
Task
features:
cancelable
uncancelable
onCancelRaiseError
bracket
start
+ cancel
+ Fiber
racePair
onErrorRestartLoop
TaskLocal
Timer
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.
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?
Deleted, wrong spot, go to monix/monix#877
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.