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:
parent
1a0a24d91a
commit
59e24e19bd
1 changed files with 24 additions and 25 deletions
|
@ -37,7 +37,7 @@ conf::item<size_t>
|
||||||
eval_max_per_node
|
eval_max_per_node
|
||||||
{
|
{
|
||||||
{ "name", "ircd.federation.send.eval.max_per_node" },
|
{ "name", "ircd.federation.send.eval.max_per_node" },
|
||||||
{ "default", 1L },
|
{ "default", 4L },
|
||||||
};
|
};
|
||||||
|
|
||||||
conf::item<bool>
|
conf::item<bool>
|
||||||
|
@ -217,9 +217,8 @@ handle_put(client &client,
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t evals{0};
|
size_t evals{0};
|
||||||
const bool txn_in_progress
|
bool txn_in_progress{false};
|
||||||
{
|
m::vm::eval::for_each([&txn_id, &request, &evals, &txn_in_progress]
|
||||||
!m::vm::eval::for_each([&txn_id, &request, &evals]
|
|
||||||
(const auto &eval)
|
(const auto &eval)
|
||||||
{
|
{
|
||||||
assert(eval.opts);
|
assert(eval.opts);
|
||||||
|
@ -235,8 +234,14 @@ handle_put(client &client,
|
||||||
};
|
};
|
||||||
|
|
||||||
evals += match_node;
|
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)
|
if(txn_in_progress)
|
||||||
|
@ -245,12 +250,6 @@ handle_put(client &client,
|
||||||
client, http::ACCEPTED
|
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
|
// Lazy-allocated response buffer; only for error transcription
|
||||||
unique_mutable_buffer response_buffer;
|
unique_mutable_buffer response_buffer;
|
||||||
const json::object &response
|
const json::object &response
|
||||||
|
|
Loading…
Reference in a new issue