Skip to content

Commit 5c5ef99

Browse files
authored
Do not send concurrent requests (#666)
1 parent e77b532 commit 5c5ef99

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/test/04-transactions.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,8 @@ describe("Transactions", () => {
8989

9090
it("can insert two documents at a time", async () => {
9191
const trx = await db.beginTransaction(collection);
92-
const [meta1, meta2] = await trx.run(() =>
93-
Promise.all([
94-
collection.save({ _key: "test1" }),
95-
collection.save({ _key: "test2" })
96-
])
97-
);
92+
const meta1 = await trx.run(() => collection.save({ _key: "test1" }));
93+
const meta2 = await trx.run(() => collection.save({ _key: "test2" }));
9894
expect(meta1).to.have.property("_key", "test1");
9995
expect(meta2).to.have.property("_key", "test2");
10096
const { id, status } = await trx.commit();
@@ -121,12 +117,8 @@ describe("Transactions", () => {
121117

122118
itRdb("does not leak when inserting two documents at a time", async () => {
123119
const trx = await db.beginTransaction(collection);
124-
await trx.run(() =>
125-
Promise.all([
126-
collection.save({ _key: "test1" }),
127-
collection.save({ _key: "test2" })
128-
])
129-
);
120+
await trx.run(() => collection.save({ _key: "test1" }));
121+
await trx.run(() => collection.save({ _key: "test2" }));
130122
let doc: any;
131123
try {
132124
doc = await collection.document("test1");

0 commit comments

Comments
 (0)