mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
delay -> sleep, style tweaks
This commit is contained in:
parent
9584638d5c
commit
cd961dad86
3 changed files with 9 additions and 6 deletions
|
|
@ -1,9 +1,10 @@
|
||||||
|
import { Conf } from '@/config.ts';
|
||||||
import { DittoDB } from '@/db/DittoDB.ts';
|
import { DittoDB } from '@/db/DittoDB.ts';
|
||||||
import { delay } from '@/test.ts';
|
import { sleep } from '@/test.ts';
|
||||||
|
|
||||||
if (Deno.env.get('CI') && Deno.env.get('DATABASE_URL')?.startsWith('postgres')) {
|
if (Deno.env.get('CI') && Conf.db.dialect === 'postgres') {
|
||||||
console.info('Waiting 15 seconds for postgres to start...');
|
console.info('Waiting 1 second for postgres to start...');
|
||||||
await delay(15000);
|
await sleep(1_000);
|
||||||
}
|
}
|
||||||
|
|
||||||
const kysely = await DittoDB.getInstance();
|
const kysely = await DittoDB.getInstance();
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export class DittoPostgres {
|
||||||
if (!this.db) {
|
if (!this.db) {
|
||||||
this.db = new Kysely({
|
this.db = new Kysely({
|
||||||
dialect: new PostgresJSDialect({
|
dialect: new PostgresJSDialect({
|
||||||
postgres: this.postgres as any,
|
postgres: this.postgres,
|
||||||
}),
|
}),
|
||||||
log: KyselyLogger,
|
log: KyselyLogger,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,6 @@ export async function getTestDB() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
export function sleep(ms: number): Promise<void> {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue