Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep writes moving with a larger WAL limit #31804

MergedYash-Singh1(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/31804/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 3 changed files with 89 additions and 2 deletions.

x
0 of 3 viewed, 3 left
87 additions and 0 deletionsapps/server/src/persistence/Sqlite.test.tsModified
View file
@@ -2,6 +2,8 @@
import * as NodeFS from "node:fs";
import * as NodeOS from "node:os";
import * as NodePath from "node:path";
+import * as NodeSqlite from "node:sqlite";
+import type * as NodeWorkerThreads from "node:worker_threads";
​
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
@@ -9,9 +11,94 @@
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as SqlClient from "effect/sql/SqlClient";
+import { vi } from "vite-plus/test";
​
import * as SqlitePersistence from "./Sqlite.ts";
​
+const workers = vi.hoisted((): Array<NodeWorkerThreads.Worker> => []);
+​
+vi.mock("node:worker_threads", async (importOriginal) => {
+ const actual = await importOriginal<typeof NodeWorkerThreads>();
+ class RecordedWorker extends actual.Worker {
+ constructor(...args: ConstructorParameters<typeof actual.Worker>) {
+ super(...args);
+ workers.push(this);
+ }
+ }
+ return { ...actual, Worker: RecordedWorker };
+});