Work on client modes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { sleep } from "../../common/async_util.ts";
|
||||
import { sleep } from "$sb/lib/async.ts";
|
||||
import { DenoKvMQ } from "./mq.deno_kv.ts";
|
||||
|
||||
Deno.test("Deno MQ", async () => {
|
||||
|
||||
@@ -41,14 +41,20 @@ export class DenoKvMQ implements MessageQueue {
|
||||
}
|
||||
|
||||
async batchSend(queue: string, bodies: any[]): Promise<void> {
|
||||
const results = await Promise.all(
|
||||
bodies.map((body) => this.kv.enqueue([queue, body])),
|
||||
);
|
||||
for (const result of results) {
|
||||
for (const body of bodies) {
|
||||
const result = await this.kv.enqueue([queue, body]);
|
||||
if (!result.ok) {
|
||||
throw result;
|
||||
}
|
||||
}
|
||||
// const results = await Promise.all(
|
||||
// bodies.map((body) => this.kv.enqueue([queue, body])),
|
||||
// );
|
||||
// for (const result of results) {
|
||||
// if (!result.ok) {
|
||||
// throw result;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
async send(queue: string, body: any): Promise<void> {
|
||||
const result = await this.kv.enqueue([queue, body]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { IDBKeyRange, indexedDB } from "https://esm.sh/fake-indexeddb@4.0.2";
|
||||
import { DexieMQ } from "./mq.dexie.ts";
|
||||
import { assertEquals } from "../../test_deps.ts";
|
||||
import { sleep } from "../../common/async_util.ts";
|
||||
import { sleep } from "$sb/lib/async.ts";
|
||||
|
||||
Deno.test("Dexie MQ", async () => {
|
||||
const mq = new DexieMQ("test", indexedDB, IDBKeyRange);
|
||||
|
||||
Reference in New Issue
Block a user