0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd:Ⓜ️:sync: Fix phased polylog invocation conditions; eliminate initial flag. (#105)

This commit is contained in:
Jason Volk 2019-08-16 03:55:07 -07:00
parent fc742ae2d0
commit 100f5c646a
9 changed files with 8 additions and 47 deletions

View file

@ -52,7 +52,6 @@ struct ircd::m::sync::item
json::strung feature; json::strung feature;
json::object opts; json::object opts;
bool phased; bool phased;
bool initial;
public: public:
string_view name() const; string_view name() const;

View file

@ -617,8 +617,8 @@ bool
ircd::m::sync::apropos(const data &d, ircd::m::sync::apropos(const data &d,
const event::idx &event_idx) const event::idx &event_idx)
{ {
return event_idx >= d.range.first && return d.phased ||
event_idx < d.range.second; (event_idx >= d.range.first && event_idx < d.range.second);
} }
ircd::string_view ircd::string_view
@ -724,10 +724,6 @@ ircd::m::sync::item::item(std::string name,
{ {
opts.get<bool>("phased", false) opts.get<bool>("phased", false)
} }
,initial
{
opts.get<bool>("initial", false)
}
{ {
log::debug log::debug
{ {
@ -757,12 +753,7 @@ try
if(!enable) if(!enable)
return false; return false;
// Skip the item for phased-sync ranges after initial sync if it has initial=true if(data.phased && !phased && int64_t(data.range.first) < 0)
if(data.phased && initial && int64_t(data.range.first) < 0L)
return false;
// Skip the item for phased-sync ranges if it's not phased-sync aware.
if(data.phased && !phased && int64_t(data.range.first) < 0L)
return false; return false;
#ifdef RB_DEBUG #ifdef RB_DEBUG

View file

@ -29,9 +29,6 @@ ircd::m::sync::account_data
"account_data", "account_data",
account_data_polylog, account_data_polylog,
account_data_linear, account_data_linear,
{
{ "initial", true }
}
}; };
bool bool

View file

@ -181,19 +181,7 @@ ircd::m::sync::_rooms_polylog(data &data,
stats.timer = timer{}; stats.timer = timer{};
#endif #endif
{ ret |= _rooms_polylog_room(data, room);
const scope_restore phased
{
data.phased, int64_t(data.range.first) < 0? false : data.phased
};
const scope_restore range
{
data.range.first, phased.theirs? 0UL : data.range.first
};
ret |= _rooms_polylog_room(data, room);
}
#if defined(RB_DEBUG) #if defined(RB_DEBUG)
thread_local char tmbuf[32]; thread_local char tmbuf[32];

View file

@ -34,9 +34,6 @@ ircd::m::sync::room_account_data
"rooms.account_data", "rooms.account_data",
room_account_data_polylog, room_account_data_polylog,
room_account_data_linear, room_account_data_linear,
{
{ "initial", true }
}
}; };
bool bool
@ -204,9 +201,7 @@ ircd::m::sync::room_account_data_polylog(data &data)
}; };
bool ret{false}; bool ret{false};
if(!data.phased || int64_t(data.range.first) > 0L) ret |= room_account_data_polylog_events(data);
ret |= room_account_data_polylog_events(data);
ret |= room_account_data_polylog_tags(data); ret |= room_account_data_polylog_tags(data);
return ret; return ret;
} }

View file

@ -227,8 +227,8 @@ ircd::m::sync::_room_state_polylog(data &data)
{ {
assert(data.args); assert(data.args);
if(likely(!data.args->full_state)) if(likely(!data.args->full_state))
if(!apropos(data, data.room_head)) if(!data.phased && int64_t(data.range.first) > 0)
if(!data.phased || int64_t(data.range.first) > 0) if(!apropos(data, data.room_head))
return false; return false;
return room_state_polylog_events(data); return room_state_polylog_events(data);

View file

@ -30,9 +30,6 @@ ircd::m::sync::room_summary
"rooms.summary", "rooms.summary",
room_summary_polylog, room_summary_polylog,
room_summary_linear, room_summary_linear,
{
{ "initial", true },
}
}; };
bool bool

View file

@ -36,10 +36,7 @@ ircd::m::sync::room_timeline
{ {
"rooms.timeline", "rooms.timeline",
room_timeline_polylog, room_timeline_polylog,
room_timeline_linear, room_timeline_linear
{
{ "initial", true },
}
}; };
decltype(ircd::m::sync::limit_default) decltype(ircd::m::sync::limit_default)

View file

@ -31,9 +31,6 @@ ircd::m::sync::room_unread_notifications
"rooms.unread_notifications", "rooms.unread_notifications",
room_unread_notifications_polylog, room_unread_notifications_polylog,
room_unread_notifications_linear, room_unread_notifications_linear,
{
{ "initial", true },
}
}; };
decltype(ircd::m::sync::exposure_depth) decltype(ircd::m::sync::exposure_depth)