0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

modules/s_fetch: Add requests limit w/ conf item.

This commit is contained in:
Jason Volk 2019-06-05 17:12:02 -07:00
parent a99a7e2501
commit ceff9f54a4
2 changed files with 11 additions and 0 deletions

View file

@ -37,6 +37,13 @@ ircd::m::fetch::auth_timeout
{ "default", 15L },
};
decltype(ircd::m::fetch::requests_max)
ircd::m::fetch::requests_max
{
{ "name", "ircd.m.fetch.requests.max" },
{ "default", 256L },
};
decltype(ircd::m::fetch::hook)
ircd::m::fetch::hook
{
@ -587,6 +594,9 @@ ircd::m::fetch::start(const m::room::id &room_id,
reflect(run::level)
};
if(count() > size_t(requests_max))
return false;
return submit(event_id, room_id);
}

View file

@ -25,6 +25,7 @@ namespace ircd::m::fetch
extern ctx::context eval_context;
extern ctx::context request_context;
extern hookfn<vm::eval &> hook;
extern conf::item<size_t> requests_max;
extern conf::item<seconds> auth_timeout;
extern conf::item<seconds> timeout;
extern conf::item<bool> enable;