fix: no logging for postgres

This commit is contained in:
Namekuji 2023-09-28 20:17:45 -04:00
parent 13ede22564
commit 2a5598fa7f
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532

View file

@ -428,25 +428,25 @@ export const UserRepository = db.getRepository(User).extend({
}).then((notes) => notes.map(({ noteId }) => noteId)); }).then((notes) => notes.map(({ noteId }) => noteId));
if (pinnedNoteIds.length > 0) { if (pinnedNoteIds.length > 0) {
try { if (scyllaClient) {
if (scyllaClient) { try {
const result = await scyllaClient.execute( const result = await scyllaClient.execute(
prepared.note.select.byIds, prepared.note.select.byIds,
[pinnedNoteIds], [pinnedNoteIds],
{ prepare: true }, { prepare: true },
); );
pinnedNotes = result.rows.map(parseScyllaNote); pinnedNotes = result.rows.map(parseScyllaNote);
} else { } catch (e) {
pinnedNotes = await Notes.findBy({ id: In(pinnedNoteIds) }); scyllaLogger.error("Failed to fetch pinned notes", {
pinnedNoteIds,
userId: user.id,
error: e,
});
pinnedNotes = [];
pinnedNoteIds = [];
} }
} catch (e) { } else {
scyllaLogger.error("Failed to fetch pinned notes", { pinnedNotes = await Notes.findBy({ id: In(pinnedNoteIds) });
pinnedNoteIds,
userId: user.id,
error: e,
});
pinnedNotes = [];
pinnedNoteIds = [];
} }
} }
} }