mirror of
https://github.com/matrix-construct/construct
synced 2025-03-13 21:10:32 +01:00
ircd:Ⓜ️:sync: Make instance-level conf::items for all sync::items.
This commit is contained in:
parent
603cc98e30
commit
ec50b0f76e
3 changed files with 26 additions and 13 deletions
|
@ -37,7 +37,6 @@ namespace ircd::m::sync
|
|||
extern log::log log;
|
||||
extern ctx::pool pool;
|
||||
extern conf::item<bool> stats_info;
|
||||
extern conf::item<bool> stats_debug;
|
||||
}
|
||||
|
||||
struct ircd::m::sync::item
|
||||
|
@ -45,6 +44,9 @@ struct ircd::m::sync::item
|
|||
{
|
||||
using handle = std::function<void (data &)>;
|
||||
|
||||
std::string conf_name[2];
|
||||
conf::item<bool> enable;
|
||||
conf::item<bool> stats_debug;
|
||||
handle _polylog;
|
||||
handle _linear;
|
||||
|
||||
|
|
31
ircd/m.cc
31
ircd/m.cc
|
@ -426,13 +426,6 @@ ircd::m::sync::stats_info
|
|||
{ "default", false },
|
||||
};
|
||||
|
||||
decltype(ircd::m::sync::stats_debug)
|
||||
ircd::m::sync::stats_debug
|
||||
{
|
||||
{ "name", "ircd.m.sync.stats.debug" },
|
||||
{ "default", false },
|
||||
};
|
||||
|
||||
bool
|
||||
ircd::m::sync::for_each(const item_closure_bool &closure)
|
||||
{
|
||||
|
@ -644,6 +637,21 @@ ircd::m::sync::item::item(std::string name,
|
|||
{
|
||||
std::move(name)
|
||||
}
|
||||
,conf_name
|
||||
{
|
||||
fmt::snstringf{128, "ircd.m.sync.%s.enable", this->name()},
|
||||
fmt::snstringf{128, "ircd.m.sync.%s.stats.debug", this->name()},
|
||||
}
|
||||
,enable
|
||||
{
|
||||
{ "name", conf_name[0] },
|
||||
{ "default", true },
|
||||
}
|
||||
,stats_debug
|
||||
{
|
||||
{ "name", conf_name[1] },
|
||||
{ "default", false },
|
||||
}
|
||||
,_polylog
|
||||
{
|
||||
std::move(polylog)
|
||||
|
@ -676,22 +684,25 @@ void
|
|||
ircd::m::sync::item::polylog(data &data)
|
||||
try
|
||||
{
|
||||
if(!enable)
|
||||
return;
|
||||
|
||||
#ifdef RB_DEBUG
|
||||
sync::stats stats
|
||||
{
|
||||
data.stats?
|
||||
data.stats && (stats_info || stats_debug)?
|
||||
*data.stats:
|
||||
sync::stats{}
|
||||
};
|
||||
|
||||
if(data.stats)
|
||||
if(data.stats && (stats_info || stats_debug))
|
||||
stats.timer = {};
|
||||
#endif
|
||||
|
||||
_polylog(data);
|
||||
|
||||
#ifdef RB_DEBUG
|
||||
if(data.stats && bool(stats_debug))
|
||||
if(data.stats && (stats_info || stats_debug))
|
||||
{
|
||||
//data.out.flush();
|
||||
thread_local char tmbuf[32];
|
||||
|
|
|
@ -93,7 +93,7 @@ ircd::m::sync::_rooms_polylog(data &data,
|
|||
data.user_rooms.for_each(membership, [&data]
|
||||
(const m::room &room, const string_view &membership_)
|
||||
{
|
||||
#ifdef RB_DEBUG
|
||||
#if defined(RB_DEBUG) && 0
|
||||
sync::stats stats
|
||||
{
|
||||
data.stats?
|
||||
|
@ -107,7 +107,7 @@ ircd::m::sync::_rooms_polylog(data &data,
|
|||
|
||||
_rooms_polylog_room(data, room);
|
||||
|
||||
#ifdef RB_DEBUG
|
||||
#if defined(RB_DEBUG) && 0
|
||||
thread_local char tmbuf[32];
|
||||
if(data.stats && bool(stats_debug)) log::debug
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue