fix(ruleset): avoid async fetch limiter deadlock

This commit is contained in:
Aethersailor
2026-05-22 01:03:26 +08:00
parent 85467568c2
commit 61083c3f0b
5 changed files with 8 additions and 6 deletions

View File

@@ -308,4 +308,4 @@ coalesce_retry_on_5xx=true
;0 disables completed response caching. Values above 5 seconds are clamped to 5.
response_cache_ttl=0
;0 disables the limiter. A small value is safer on single-core deployments.
max_async_fetches=2
max_async_fetches=0

View File

@@ -366,4 +366,4 @@ coalesce_retry_on_5xx = true
# 0 disables completed response caching. If enabled, values above 5 seconds are clamped to 5.
response_cache_ttl = 0
# 0 disables the limiter. A small value is safer on single-core deployments.
max_async_fetches = 2
max_async_fetches = 0

View File

@@ -175,4 +175,4 @@ advanced:
enable_request_coalescing: true
coalesce_retry_on_5xx: true
response_cache_ttl: 0
max_async_fetches: 2
max_async_fetches: 0

View File

@@ -129,8 +129,10 @@ std::shared_future<std::string> fetchFileAsync(const std::string &path, const st
retVal = std::async(std::launch::async, [path](){return fileGet(path, true);});
else if(isLink(path))
{
auto slot = acquireAsyncFetchSlot();
retVal = std::async(std::launch::async, [path, proxy, cache_ttl, context, slot](){return webGet(path, proxy, cache_ttl, nullptr, nullptr, context);});
retVal = std::async(std::launch::async, [path, proxy, cache_ttl, context](){
auto slot = acquireAsyncFetchSlot();
return webGet(path, proxy, cache_ttl, nullptr, nullptr, context);
});
}
else
return make_ready_future(std::string());

View File

@@ -79,7 +79,7 @@ struct Settings {
// request coalescing and bounded background work
bool enableRequestCoalescing = true, coalesceRetryOn5xx = true;
int responseCacheTtl = 0, maxAsyncFetches = 2;
int responseCacheTtl = 0, maxAsyncFetches = 0;
unsigned long long configGeneration = 0;
// limits