0

I'm trying to get a bit of parallelism in my app to decrease the amount of time some operations take. I noticed that Parse.Promise.when() seems to evaluate promises in parallel. But there seems to be no limit to how many promises it tries to evaluate in parallel, is that right?

In this particular example I'm trying to do something to 1500 records. If I use .when, it looks like it's trying to make 1500 connections to the parse api and it seems to be failing somewhere. But when I do these 1500 operations in series, it seems to take forever.

How do you guys deal with this kind of problem?

One way I thought of to deal with this kind of problem might be to modify Parse.Promise.when() so that when I call it, I can specify the level of parallelism I need. e.g. Parse.Promise.when(promises, 10)

Thanks

asdf01
  • 93
  • 5

1 Answers1

0

No, there is not. when does not "evaluate" or "call" promises, it just waits for already existing promises whose tasks are already running since you created them. It's the same as for Promise.all.

Have a look at Limit concurrency of promise being run on how to deal with calling an asynchronous function multiple times.

Community
  • 1
  • 1
Bergi
  • 630,263
  • 148
  • 957
  • 1,375