Fix timeline fetch when using sinceId
This commit is contained in:
parent
5615675991
commit
4a8ffe20a7
|
@ -70,14 +70,13 @@ export class FanoutTimelineEndpointService {
|
|||
shouldFallbackToDb = ps.useDbFallback && (redisResult.length > 1 && redisResult.some(ids => ids.length === 0));
|
||||
|
||||
// 取得したresultの中で最古のIDのうち、最も新しいものを取得
|
||||
// shouldPrependがtrueの場合は最も新しいものを、falseの場合は最も古いものを取得
|
||||
const thresholdId = shouldPrepend ? redisResult.map(ids => ids[ids.length - 1]).sort(idCompare)[0] : redisResult.map(ids => ids[0]).sort(idCompare)[0];
|
||||
const thresholdId = redisResult.map(ids => ids[0]).sort()[0];
|
||||
|
||||
// TODO: いい感じにgetMulti内でソート済だからuniqするときにredisResultが全てソート済なのを利用して再ソートを避けたい
|
||||
const redisResultIds = shouldFallbackToDb ? [] : Array.from(new Set(redisResult.flat(1))).filter(id => idCompare(id, thresholdId) === 1);
|
||||
const redisResultIds = shouldFallbackToDb ? [] : Array.from(new Set(redisResult.flat(1)));
|
||||
|
||||
redisResultIds.sort(idCompare);
|
||||
noteIds = redisResultIds.slice(0, ps.limit);
|
||||
noteIds = redisResultIds.filter(id => id >= thresholdId).slice(0, ps.limit);
|
||||
|
||||
shouldFallbackToDb = shouldFallbackToDb || (noteIds.length === 0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue