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) {
|
if (keys.length === 0) {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
keys = keys.map((key) => key.slice(redisPrefix?.length));
|
keys = keys.map((key) => key.slice(redisPrefix.length));
|
||||||
const values = await redisClient.mgetBuffer(keys);
|
const values = await redisClient.mgetBuffer(keys);
|
||||||
|
|
||||||
for (const [i, key] of keys.entries()) {
|
for (const [i, key] of keys.entries()) {
|
||||||
|
|
|
@ -422,6 +422,7 @@ export const UserRepository = db.getRepository(User).extend({
|
||||||
},
|
},
|
||||||
}).then((notes) => notes.map(({ noteId }) => noteId));
|
}).then((notes) => notes.map(({ noteId }) => noteId));
|
||||||
|
|
||||||
|
if (pinnedNoteIds.length > 0) {
|
||||||
if (scyllaClient) {
|
if (scyllaClient) {
|
||||||
const result = await scyllaClient.execute(
|
const result = await scyllaClient.execute(
|
||||||
prepared.note.select.byIds,
|
prepared.note.select.byIds,
|
||||||
|
@ -433,6 +434,7 @@ export const UserRepository = db.getRepository(User).extend({
|
||||||
pinnedNotes = await Notes.findBy({ id: In(pinnedNoteIds) });
|
pinnedNotes = await Notes.findBy({ id: In(pinnedNoteIds) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const profile = opts.detail
|
const profile = opts.detail
|
||||||
? await UserProfiles.findOneByOrFail({ userId: user.id })
|
? await UserProfiles.findOneByOrFail({ userId: user.id })
|
||||||
|
|
Loading…
Reference in a new issue