fix: skip if pinnedNotes are empty
This commit is contained in:
parent
93a500be0d
commit
668a8a1429
2 changed files with 12 additions and 10 deletions
|
@ -60,7 +60,7 @@ export class Cache<T> {
|
|||
if (keys.length === 0) {
|
||||
return map;
|
||||
}
|
||||
keys = keys.map((key) => key.slice(redisPrefix?.length));
|
||||
keys = keys.map((key) => key.slice(redisPrefix.length));
|
||||
const values = await redisClient.mgetBuffer(keys);
|
||||
|
||||
for (const [i, key] of keys.entries()) {
|
||||
|
|
|
@ -422,15 +422,17 @@ export const UserRepository = db.getRepository(User).extend({
|
|||
},
|
||||
}).then((notes) => notes.map(({ noteId }) => noteId));
|
||||
|
||||
if (scyllaClient) {
|
||||
const result = await scyllaClient.execute(
|
||||
prepared.note.select.byIds,
|
||||
[pinnedNoteIds],
|
||||
{ prepare: true },
|
||||
);
|
||||
pinnedNotes = result.rows.map(parseScyllaNote);
|
||||
} else {
|
||||
pinnedNotes = await Notes.findBy({ id: In(pinnedNoteIds) });
|
||||
if (pinnedNoteIds.length > 0) {
|
||||
if (scyllaClient) {
|
||||
const result = await scyllaClient.execute(
|
||||
prepared.note.select.byIds,
|
||||
[pinnedNoteIds],
|
||||
{ prepare: true },
|
||||
);
|
||||
pinnedNotes = result.rows.map(parseScyllaNote);
|
||||
} else {
|
||||
pinnedNotes = await Notes.findBy({ id: In(pinnedNoteIds) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue