puppet icon indicating copy to clipboard operation
puppet copied to clipboard

Promise.all with concurrency limitation implementation

Open windmemory opened this issue 4 years ago • 3 comments

Related to https://github.com/wechaty/wechaty-puppet-hostie/issues/31

Currently the code logic for roomSearch in wechaty-puppet is not using batch operation, like below:

https://github.com/wechaty/wechaty-puppet/blob/804b31b970e931547238d59de43847178a2869cd/src/puppet.ts#L1174-L1212

When the query is passed to the function, it will do a Promise.all() of all rooms, which might cause the problem that we've been fighting for a long time, the grpc issue. So I think we need to use batch operation for this method to avoid the grpc problem.

windmemory avatar Oct 07 '20 20:10 windmemory

Thank your very much for this great improvement!

huan avatar Oct 08 '20 02:10 huan

Let's close this issue since the problem should be fixed.

windmemory avatar Oct 08 '20 12:10 windmemory

I'm planning to use async pool or iterator worker or p-map to implement a Promise.all() with a concurrency limitation for a better performance.

huan avatar Aug 17 '21 05:08 huan