0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

modules/client/sync: Various range check fixes; simplify debug stats.

This commit is contained in:
Jason Volk 2019-01-26 17:01:36 -08:00
parent d2380ecd36
commit 8c5b1f283f
6 changed files with 15 additions and 35 deletions

View file

@ -148,7 +148,6 @@ ircd::m::sync::handle_get(client &client,
if(shortpolled)
return response;
// When longpoll was successful, do nothing else.
if(longpoll::poll(data, args))
return response;

View file

@ -94,25 +94,6 @@ ircd::m::sync::_rooms_polylog(data &data,
(const m::room &room, const string_view &membership_)
{
#ifdef RB_DEBUG
const auto head_idx
{
m::head_idx(std::nothrow, room)
};
// Generate individual stats for this room's sync
assert(head_idx); // room should exist
sync::stats *const statsp
{
head_idx >= data.range.first?
data.stats:
nullptr
};
const scope_restore<decltype(data.stats)> statsp_
{
data.stats, statsp
};
sync::stats stats
{
data.stats?
@ -133,9 +114,7 @@ ircd::m::sync::_rooms_polylog(data &data,
log, "polylog %s %s in %s",
loghead(data),
string_view{room.room_id},
data.stats?
ircd::pretty(tmbuf, stats.timer.at<milliseconds>(), true):
string_view{"<no stats>"}
ircd::pretty(tmbuf, stats.timer.at<milliseconds>(), true)
};
#endif
});

View file

@ -60,7 +60,7 @@ ircd::m::sync::room_ephemeral_m_receipt_m_read_polylog(data &data)
}
};
members.for_each(m::room::members::closure{[&parallel, &q, &buf]
members.for_each("join", m::room::members::closure{[&parallel, &q, &buf]
(const m::user::id &user_id)
{
const auto pos(parallel.nextpos());

View file

@ -88,7 +88,7 @@ ircd::m::sync::room_state_polylog(data &data)
m::head_idx(std::nothrow, *data.room)
};
if(head_idx < data.range.first)
if(!apropos(data, head_idx))
return;
room_state_polylog_events(data);

View file

@ -109,7 +109,7 @@ ircd::m::sync::room_timeline_polylog(data &data)
m::head_idx(std::nothrow, *data.room)
};
if(head_idx < data.range.first)
if(!apropos(data, head_idx))
return;
// events
@ -163,10 +163,7 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
for(; it && i < 10; --it, ++i)
{
event_id = it.event_id();
if(it.event_idx() < data.range.first)
break;
if(it.event_idx() >= data.range.second)
if(!apropos(data, it.event_idx()))
break;
}
@ -187,6 +184,7 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
if(i > 0)
for(; it && i > -1; ++it, --i)
{
data.commit();
json::stack::object object
{
array

View file

@ -45,16 +45,20 @@ ircd::m::sync::room_unread_notifications_polylog(data &data)
if(!m::receipt::read(last_read, room.room_id, data.user))
return;
data.commit();
const auto start_idx
{
index(last_read)
};
json::stack::object out
{
data.out
};
const auto start_idx
{
index(last_read)
};
if(!apropos(data, start_idx))
return;
data.commit();
// highlight_count
json::stack::member