mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
modules/console: Add conf item for events dump buffer size; use various size constants.
This commit is contained in:
parent
1309565506
commit
67e31ed481
1 changed files with 11 additions and 4 deletions
|
@ -2660,6 +2660,13 @@ console_cmd__events__filter(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conf::item<size_t>
|
||||||
|
events_dump_buffer_size
|
||||||
|
{
|
||||||
|
{ "name", "ircd.console.events.dump.buffer_size" },
|
||||||
|
{ "default", int64_t(4_MiB) },
|
||||||
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
console_cmd__events__dump(opt &out, const string_view &line)
|
console_cmd__events__dump(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
|
@ -2675,7 +2682,7 @@ console_cmd__events__dump(opt &out, const string_view &line)
|
||||||
|
|
||||||
const unique_buffer<mutable_buffer> buf
|
const unique_buffer<mutable_buffer> buf
|
||||||
{
|
{
|
||||||
512_KiB
|
size_t(events_dump_buffer_size)
|
||||||
};
|
};
|
||||||
|
|
||||||
char *pos{data(buf)};
|
char *pos{data(buf)};
|
||||||
|
@ -2688,12 +2695,12 @@ console_cmd__events__dump(opt &out, const string_view &line)
|
||||||
size_t(data(buf) + size(buf) - pos)
|
size_t(data(buf) + size(buf) - pos)
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(remain >= 64_KiB && remain <= size(buf));
|
assert(remain >= m::event::MAX_SIZE && remain <= size(buf));
|
||||||
const mutable_buffer mb{pos, remain};
|
const mutable_buffer mb{pos, remain};
|
||||||
pos += json::print(mb, event);
|
pos += json::print(mb, event);
|
||||||
++ecount;
|
++ecount;
|
||||||
|
|
||||||
if(pos + 64_KiB > data(buf) + size(buf))
|
if(pos + m::event::MAX_SIZE > data(buf) + size(buf))
|
||||||
{
|
{
|
||||||
const const_buffer cb{data(buf), pos};
|
const const_buffer cb{data(buf), pos};
|
||||||
foff += size(fs::append(filename, cb));
|
foff += size(fs::append(filename, cb));
|
||||||
|
@ -5240,7 +5247,7 @@ console_cmd__fed__send(opt &out, const string_view &line)
|
||||||
event_id
|
event_id
|
||||||
};
|
};
|
||||||
|
|
||||||
thread_local char pdubuf[64_KiB];
|
thread_local char pdubuf[m::event::MAX_SIZE];
|
||||||
const json::value pdu
|
const json::value pdu
|
||||||
{
|
{
|
||||||
json::stringify(mutable_buffer{pdubuf}, event)
|
json::stringify(mutable_buffer{pdubuf}, event)
|
||||||
|
|
Loading…
Reference in a new issue