* fix: RedisTimelineが有効の場合にHTLがリセットされた状態になる問題を修正 * add: CHANGELOG.md * fix: LTL, STLでもTLが空になることがある問題を修正 * update: CHANGELOG.md * fix: DBへのフォールバック時にwithRenotesが考慮されていないのを修正 * feat: リストにもDBフォールバックを実装 * fix: リストのDBフォールバック時の挙動を修正 --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
7e15f71916
commit
0c730968a3
5 changed files with 154 additions and 49 deletions
|
@ -110,6 +110,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
|
||||
noteIds = noteIds.slice(0, ps.limit);
|
||||
|
||||
let redisTimeline: MiNote[] = [];
|
||||
|
||||
if (noteIds.length > 0) {
|
||||
const query = this.notesRepository.createQueryBuilder('note')
|
||||
.where('note.id IN (:...noteIds)', { noteIds: noteIds })
|
||||
|
@ -120,9 +122,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
.leftJoinAndSelect('renote.user', 'renoteUser')
|
||||
.leftJoinAndSelect('note.channel', 'channel');
|
||||
|
||||
let timeline = await query.getMany();
|
||||
redisTimeline = await query.getMany();
|
||||
|
||||
timeline = timeline.filter(note => {
|
||||
redisTimeline = redisTimeline.filter(note => {
|
||||
if (me && (note.userId === me.id)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -139,17 +141,17 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
return true;
|
||||
});
|
||||
|
||||
// TODO: フィルタした結果件数が足りなかった場合の対応
|
||||
|
||||
timeline.sort((a, b) => a.id > b.id ? -1 : 1);
|
||||
redisTimeline.sort((a, b) => a.id > b.id ? -1 : 1);
|
||||
}
|
||||
|
||||
if (redisTimeline.length > 0) {
|
||||
process.nextTick(() => {
|
||||
if (me) {
|
||||
this.activeUsersChart.read(me);
|
||||
}
|
||||
});
|
||||
|
||||
return await this.noteEntityService.packMany(timeline, me);
|
||||
return await this.noteEntityService.packMany(redisTimeline, me);
|
||||
} else { // fallback to db
|
||||
return await this.getFromDb({
|
||||
untilId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue