What does it mean that in Fluture fork should be used in one place?

100 views Asked by At

I was reading about Fluture, and one way to consume a Future is to call fork. That is all understandable so far but in documentation it states:
"Generally, one only needs to call fork in a single place in the entire program".

What does it mean? What if I'm using Futures to fetch some content from Api request, I would probably want to do this multiple times throughout the code each with different resolve functions. All of these Futures would then require their own forks, right?

1

There are 1 answers

1
Bergi On BEST ANSWER

It is expected that you build your entire program as a big Future, composed of smaller futures (like many Api calls chained to each other), and only in your main entrypoint do call fork().