fix: add multiple access to db
This commit is contained in:
BIN
notes.db-journal
Normal file
BIN
notes.db-journal
Normal file
Binary file not shown.
@@ -2,6 +2,13 @@ import { DB } from "https://deno.land/x/sqlite/mod.ts";
|
|||||||
import type { Note } from "./note.ts";
|
import type { Note } from "./note.ts";
|
||||||
|
|
||||||
export const db = new DB(Deno.env.get("SQLITE_PATH") ?? "notes.db");
|
export const db = new DB(Deno.env.get("SQLITE_PATH") ?? "notes.db");
|
||||||
|
try {
|
||||||
|
const [[journalMode]] = db.query<[string]>("PRAGMA journal_mode=WAL");
|
||||||
|
db.query("PRAGMA busy_timeout=5000");
|
||||||
|
console.log(`[db] journal_mode=${journalMode}, busy_timeout=5000`);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("[db] failed to set PRAGMAs:", e);
|
||||||
|
}
|
||||||
|
|
||||||
export const getNotes = (cursor?: string, limit = 20) => {
|
export const getNotes = (cursor?: string, limit = 20) => {
|
||||||
const rows = cursor
|
const rows = cursor
|
||||||
|
|||||||
Reference in New Issue
Block a user