27542
Convex Communityβ€’2d agoβ€’
8 replies
2754

For-loop or Promise-all?

Regarding how
for
loop work in the mutation, which of the following is correct?

1. The
await
on each
insert
,
update
,
delete
, etc. is effectively ignored in terms of execution β€” only its intent is preserved β€” and all changes are committed together in a single transaction when the mutation function ends.
2. Each
await
is converted into an enqueue operation, and the time spent enqueuing is negligible. (However, in this case, using
Promise.all
would still be slightly faster than a
for
loop, which would contradict the earlier comment.)
3. Neither of the above. (Could you explain? πŸ™‡)
Was this page helpful?