mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
switch to deno.land/postgresjs for free 4x speed increase
This commit is contained in:
parent
ae140933f5
commit
98aaab8e51
4 changed files with 10 additions and 2 deletions
|
|
@ -50,8 +50,8 @@
|
|||
"iso-639-1": "npm:iso-639-1@2.1.15",
|
||||
"isomorphic-dompurify": "npm:isomorphic-dompurify@^2.11.0",
|
||||
"kysely": "npm:kysely@^0.27.3",
|
||||
"postgres": "https://deno.land/x/postgresjs@v3.4.3/mod.js",
|
||||
"kysely-postgres-js": "npm:kysely-postgres-js@2.0.0",
|
||||
"postgres": "npm:postgres@3.4.4",
|
||||
"light-bolt11-decoder": "npm:light-bolt11-decoder",
|
||||
"linkify-plugin-hashtag": "npm:linkify-plugin-hashtag@^4.1.1",
|
||||
"linkify-string": "npm:linkify-string@^4.1.1",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
import { DittoDB } from '@/db/DittoDB.ts';
|
||||
import { delay } from '@/test.ts';
|
||||
|
||||
if (Deno.env.get('CI') && Deno.env.get('DATABASE_URL')?.startsWith('postgres')) {
|
||||
console.info('Waiting 15 seconds for postgres to start...');
|
||||
await delay(15000);
|
||||
}
|
||||
|
||||
const kysely = await DittoDB.getInstance();
|
||||
await kysely.destroy();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export class DittoPostgres {
|
|||
if (!this.db) {
|
||||
this.db = new Kysely({
|
||||
dialect: new PostgresJSDialect({
|
||||
postgres: postgres(Conf.databaseUrl)
|
||||
postgres: postgres(Conf.databaseUrl) as any
|
||||
}),
|
||||
log: KyselyLogger
|
||||
});
|
||||
|
|
|
|||
|
|
@ -62,3 +62,5 @@ export async function getTestDB() {
|
|||
[Symbol.asyncDispose]: () => kysely.destroy(),
|
||||
};
|
||||
}
|
||||
|
||||
export const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
Loading…
Add table
Reference in a new issue