0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

modules/federation/send: Relax default restrictions on parallel evaluations.

This commit is contained in:
Jason Volk 2020-04-20 00:29:41 -07:00
parent 1a0a24d91a
commit 59e24e19bd

View file

@ -37,7 +37,7 @@ conf::item<size_t>
eval_max_per_node
{
{ "name", "ircd.federation.send.eval.max_per_node" },
{ "default", 1L },
{ "default", 4L },
};
conf::item<bool>
@ -217,9 +217,8 @@ handle_put(client &client,
};
size_t evals{0};
const bool txn_in_progress
{
!m::vm::eval::for_each([&txn_id, &request, &evals]
bool txn_in_progress{false};
m::vm::eval::for_each([&txn_id, &request, &evals, &txn_in_progress]
(const auto &eval)
{
assert(eval.opts);
@ -235,8 +234,14 @@ handle_put(client &client,
};
evals += match_node;
return !match_txn; // false to break; for_each() returns false
})
txn_in_progress |= match_txn;
return evals < size_t(eval_max_per_node);
});
if(evals >= size_t(eval_max_per_node))
return m::resource::response
{
client, http::TOO_MANY_REQUESTS
};
if(txn_in_progress)
@ -245,12 +250,6 @@ handle_put(client &client,
client, http::ACCEPTED
};
if(evals >= size_t(eval_max_per_node))
return m::resource::response
{
client, http::TOO_MANY_REQUESTS
};
// Lazy-allocated response buffer; only for error transcription
unique_mutable_buffer response_buffer;
const json::object &response