mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
Always make sure we have 1 free http state available for synchronous requests
If it wasn't for the fact that the HTTP client is likely going to see a major refactor, it would definitely be time to create a specific state instance for synchronous requests.
This commit is contained in:
@@ -287,6 +287,12 @@ const AsyncQueue = struct {
|
|||||||
|
|
||||||
fn _check(self: *AsyncQueue, repeat_delay: *?u63) !void {
|
fn _check(self: *AsyncQueue, repeat_delay: *?u63) !void {
|
||||||
const client = self.client;
|
const client = self.client;
|
||||||
|
if (client.freeSlotCount() == 1) {
|
||||||
|
// always leave 1 free connection for sync requests
|
||||||
|
repeat_delay.* = 10 * std.time.ns_per_ms;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const state = client.state_pool.acquireOrNull() orelse {
|
const state = client.state_pool.acquireOrNull() orelse {
|
||||||
// re-run this function in 10 milliseconds
|
// re-run this function in 10 milliseconds
|
||||||
repeat_delay.* = 10 * std.time.ns_per_ms;
|
repeat_delay.* = 10 * std.time.ns_per_ms;
|
||||||
@@ -3802,7 +3808,7 @@ const TestContext = struct {
|
|||||||
errdefer loop.deinit();
|
errdefer loop.deinit();
|
||||||
|
|
||||||
var o = opts;
|
var o = opts;
|
||||||
o.max_concurrent = 1;
|
o.max_concurrent = 2;
|
||||||
|
|
||||||
const client = try Client.init(testing.allocator, loop, o);
|
const client = try Client.init(testing.allocator, loop, o);
|
||||||
errdefer client.deinit();
|
errdefer client.deinit();
|
||||||
|
|||||||
Reference in New Issue
Block a user