uwazi icon indicating copy to clipboard operation
uwazi copied to clipboard

Remove `for await` loops on distributed jobs

Open elreplicante opened this issue 2 years ago • 1 comments

for await loops are intended to be used on async iterators/generators. During the development of the sync feature as a distributed loop, we noticed that the behaviour of this loops is not strictly sequential, which can lead to unexpected effects on the implementation.

As we used that approach moving the TOC job to a distributed loop, we think moving back to a reduce loop approach is the way to implement asynchronous calls inside loops.

elreplicante avatar Jun 21 '22 07:06 elreplicante

How about a plain old loop (for generators, maybe one of the whiles)? If I remember correctly, we have talked about ignoring the "no await in loop" rule in specific cases where it is needed.

LaszloKecskes avatar Jun 23 '22 07:06 LaszloKecskes