perf: remove fallback to postgres

This commit is contained in:
Namekuji 2023-08-10 04:48:22 -04:00
parent 742c41558a
commit 091f740a29
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532
2 changed files with 2 additions and 9 deletions

View file

@ -196,7 +196,6 @@ export const NoteRepository = db.getRepository(Note).extend({
const meId = me ? me.id : null; const meId = me ? me.id : null;
let note: Note | null = null; let note: Note | null = null;
let foundScyllaNote = false;
const isSrcNote = typeof src === "object"; const isSrcNote = typeof src === "object";
// Always lookup from ScyllaDB if enabled // Always lookup from ScyllaDB if enabled
@ -212,11 +211,8 @@ export const NoteRepository = db.getRepository(Note).extend({
); );
if (result.rowLength > 0) { if (result.rowLength > 0) {
note = parseScyllaNote(result.first()); note = parseScyllaNote(result.first());
foundScyllaNote = true;
} }
} } else {
if (!foundScyllaNote) {
// Fallback to Postgres
note = await this.findOneBy({ id: noteId }); note = await this.findOneBy({ id: noteId });
} }
} }

View file

@ -33,10 +33,7 @@ export async function getNote(
note = filtered[0]; note = filtered[0];
} }
} }
} } else {
// Fallback to Postgres
if (!note) {
const query = Notes.createQueryBuilder("note").where("note.id = :id", { const query = Notes.createQueryBuilder("note").where("note.id = :id", {
id: noteId, id: noteId,
}); });