mirror of
https://github.com/matrix-construct/construct
synced 2024-11-30 02:32:43 +01:00
modules/client/sync: Various range check fixes; simplify debug stats.
This commit is contained in:
parent
d2380ecd36
commit
8c5b1f283f
6 changed files with 15 additions and 35 deletions
|
@ -148,7 +148,6 @@ ircd::m::sync::handle_get(client &client,
|
||||||
if(shortpolled)
|
if(shortpolled)
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
// When longpoll was successful, do nothing else.
|
|
||||||
if(longpoll::poll(data, args))
|
if(longpoll::poll(data, args))
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
|
|
|
@ -94,25 +94,6 @@ ircd::m::sync::_rooms_polylog(data &data,
|
||||||
(const m::room &room, const string_view &membership_)
|
(const m::room &room, const string_view &membership_)
|
||||||
{
|
{
|
||||||
#ifdef RB_DEBUG
|
#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
|
sync::stats stats
|
||||||
{
|
{
|
||||||
data.stats?
|
data.stats?
|
||||||
|
@ -133,9 +114,7 @@ ircd::m::sync::_rooms_polylog(data &data,
|
||||||
log, "polylog %s %s in %s",
|
log, "polylog %s %s in %s",
|
||||||
loghead(data),
|
loghead(data),
|
||||||
string_view{room.room_id},
|
string_view{room.room_id},
|
||||||
data.stats?
|
ircd::pretty(tmbuf, stats.timer.at<milliseconds>(), true)
|
||||||
ircd::pretty(tmbuf, stats.timer.at<milliseconds>(), true):
|
|
||||||
string_view{"<no stats>"}
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,7 +60,7 @@ ircd::m::sync::room_ephemeral_m_receipt_m_read_polylog(data &data)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
members.for_each(m::room::members::closure{[¶llel, &q, &buf]
|
members.for_each("join", m::room::members::closure{[¶llel, &q, &buf]
|
||||||
(const m::user::id &user_id)
|
(const m::user::id &user_id)
|
||||||
{
|
{
|
||||||
const auto pos(parallel.nextpos());
|
const auto pos(parallel.nextpos());
|
||||||
|
|
|
@ -88,7 +88,7 @@ ircd::m::sync::room_state_polylog(data &data)
|
||||||
m::head_idx(std::nothrow, *data.room)
|
m::head_idx(std::nothrow, *data.room)
|
||||||
};
|
};
|
||||||
|
|
||||||
if(head_idx < data.range.first)
|
if(!apropos(data, head_idx))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
room_state_polylog_events(data);
|
room_state_polylog_events(data);
|
||||||
|
|
|
@ -109,7 +109,7 @@ ircd::m::sync::room_timeline_polylog(data &data)
|
||||||
m::head_idx(std::nothrow, *data.room)
|
m::head_idx(std::nothrow, *data.room)
|
||||||
};
|
};
|
||||||
|
|
||||||
if(head_idx < data.range.first)
|
if(!apropos(data, head_idx))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// events
|
// events
|
||||||
|
@ -163,10 +163,7 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
|
||||||
for(; it && i < 10; --it, ++i)
|
for(; it && i < 10; --it, ++i)
|
||||||
{
|
{
|
||||||
event_id = it.event_id();
|
event_id = it.event_id();
|
||||||
if(it.event_idx() < data.range.first)
|
if(!apropos(data, it.event_idx()))
|
||||||
break;
|
|
||||||
|
|
||||||
if(it.event_idx() >= data.range.second)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +184,7 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
|
||||||
if(i > 0)
|
if(i > 0)
|
||||||
for(; it && i > -1; ++it, --i)
|
for(; it && i > -1; ++it, --i)
|
||||||
{
|
{
|
||||||
|
data.commit();
|
||||||
json::stack::object object
|
json::stack::object object
|
||||||
{
|
{
|
||||||
array
|
array
|
||||||
|
|
|
@ -45,16 +45,20 @@ ircd::m::sync::room_unread_notifications_polylog(data &data)
|
||||||
if(!m::receipt::read(last_read, room.room_id, data.user))
|
if(!m::receipt::read(last_read, room.room_id, data.user))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
data.commit();
|
const auto start_idx
|
||||||
|
{
|
||||||
|
index(last_read)
|
||||||
|
};
|
||||||
|
|
||||||
json::stack::object out
|
json::stack::object out
|
||||||
{
|
{
|
||||||
data.out
|
data.out
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto start_idx
|
if(!apropos(data, start_idx))
|
||||||
{
|
return;
|
||||||
index(last_read)
|
|
||||||
};
|
data.commit();
|
||||||
|
|
||||||
// highlight_count
|
// highlight_count
|
||||||
json::stack::member
|
json::stack::member
|
||||||
|
|
Loading…
Reference in a new issue