Limit for number of Tasks running in sequence?
See original GitHub issueThe number of Tasks that can be run in sequence seems to be limited by the max size of the function stack for the platform. Sample code:
import R from 'ramda';
import Task from 'data.task';
import monads from 'control.monads';
const COUNT = 10000;
const l = R.repeat(1, COUNT);
monads.sequence(Task,
R.map(Task.of, l))
.fork((err) => console.error(err),
(res) => console.log(res));
will produce:
/home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:113
return new Task(function(reject, resolve) {
^
RangeError: Maximum call stack size exceeded
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:113:27
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:114:12
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:114:12
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:114:12
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:114:12
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:114:12
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:114:12
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:114:12
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:114:12
at /home/francisco/Documents/code/folktale/node_modules/data.task/lib/task.js:114:12
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Is there a limit on Number of Task Sequences : r/SCCM - Reddit
The task sequence environment is only 32MB. TS policy, dependent policies, content locations, user variables, built-in variables and private ...
Read more >Task sequence step limit? - TechNet - Microsoft
The correct answer to this question is, unknown. There is a size limit to the task sequence environment, which is 10Mb. I have...
Read more >c# - How to limit the number of active Tasks running via the ...
I have some ConcurrentQueue that contain Action ( System.Action ). Each action in this queue need to run ( need to be called...
Read more >resources - to limit the number of concurrently running tasks.
In this pattern, we use resources to limit the number of concurrently running tasks. By default, Ray tasks require 1 CPU each and...
Read more >Limit number of tasks running in parallel in Server
It's not possible to limit the number of tasks that are running in parallel. However, it's possible to make one or more tasks...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@robotlolita It doesn’t use free monads directly, but the same principal. Every operation just builds up a structure (much resembling an AST) and
fork
is the interpreter of that structure.fork
uses the same trick that is used in ChainRec implementations, where everything is executed in a singlewhile
-loop that only breaks when the operation did not call back synchronously.The second trick is the flattening of newly encountered AST’s. When we call a
chain
, for example, we (lazily) get back a new AST, which is flattened into the current one at runtime, allowing thewhile
-loop to continue without having to break. This part makes it so even recursion is stack safe.Not just that. Almost all operations in Fluture are stack safe. ChainRec is really just there for interoperability. Just try to run the exact same code given above but using Fluture:
On my i5 machine, after 2.8 seconds, we see:
This all happened in the same tick we called
fork
.