puppet
puppet copied to clipboard
Promise.all with concurrency limitation implementation
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.
Thank your very much for this great improvement!
Let's close this issue since the problem should be fixed.
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.