mirror of
https://github.com/matrix-construct/construct
synced 2024-11-04 21:08:57 +01:00
modules/client/sync/rooms/timeline: Add conditional prefetch on down iteration.
This commit is contained in:
parent
a5a0adb2c5
commit
c77353fd9c
1 changed files with 4 additions and 1 deletions
|
@ -248,7 +248,6 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
|
||||||
room
|
room
|
||||||
};
|
};
|
||||||
|
|
||||||
ssize_t i(0);
|
|
||||||
const ssize_t limit
|
const ssize_t limit
|
||||||
{
|
{
|
||||||
data.phased && data.range.first == 0?
|
data.phased && data.range.first == 0?
|
||||||
|
@ -256,6 +255,7 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
|
||||||
ssize_t(limit_default)
|
ssize_t(limit_default)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ssize_t i(0), prefetched(0);
|
||||||
for(; it && i <= limit; --it)
|
for(; it && i <= limit; --it)
|
||||||
{
|
{
|
||||||
event_idx = it.event_idx();
|
event_idx = it.event_idx();
|
||||||
|
@ -265,6 +265,9 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
|
||||||
if(event_idx < data.range.first)
|
if(event_idx < data.range.first)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if(limit > 1)
|
||||||
|
prefetched += m::prefetch(event_idx);
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue