IgorI
Convex Communityβ€’2mo agoβ€’
1 reply
Igor

Does await block next query?

Is the sequential await blocking? Or does convex special magic sauce call them at the same time? As I'm typing out this question, I'm realizing it must block it in case the second query needs data from the first. But I guess I'll ask in case anyone else questions this.

const users1 = await promise.all(
  userIds.map((userId) => ctx.db.get(userId))
);

const users2 = await promise.all(
  userIds.map((userId) => ctx.db.get(userId))
);

vs
const [users1, users2] = await Promise.all([
  await promise.all(
    userIds.map((userId) => ctx.db.get(userId))
  ),

  await promise.all(
    userIds.map((userId) => ctx.db.get(userId))
  )
]);
Was this page helpful?