add test server timeout
This commit is contained in:
parent
ebb727c464
commit
12c7c46594
1 changed files with 5 additions and 3 deletions
|
@ -1591,10 +1591,11 @@ const TestOptions = struct {
|
||||||
return error.HeaderOrValueNotFound;
|
return error.HeaderOrValueNotFound;
|
||||||
}
|
}
|
||||||
fn waitForReady(self: *Self) !void {
|
fn waitForReady(self: *Self) !void {
|
||||||
// While this doesn't return an error, we can use !void
|
// Set 1 minute timeout...this is way longer than necessary
|
||||||
// to prepare for addition of timeout
|
var remaining_iters: isize = std.time.ns_per_min / 100;
|
||||||
while (!self.server_ready)
|
while (!self.server_ready and remaining_iters > 0) : (remaining_iters -= 1)
|
||||||
std.time.sleep(100);
|
std.time.sleep(100);
|
||||||
|
if (!self.server_ready) return error.TestServerTimeoutWaitingForReady;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1622,6 +1623,7 @@ fn threadMain(options: *TestOptions) !void {
|
||||||
// var aa = arena.allocator();
|
// var aa = arena.allocator();
|
||||||
// We're in control of all requests/responses, so this flag will tell us
|
// We're in control of all requests/responses, so this flag will tell us
|
||||||
// when it's time to shut down
|
// when it's time to shut down
|
||||||
|
defer options.server_ready = true; // In case remaining_requests = 0, we don't want to wait forever
|
||||||
while (options.server_remaining_requests > 0) {
|
while (options.server_remaining_requests > 0) {
|
||||||
options.server_remaining_requests -= 1;
|
options.server_remaining_requests -= 1;
|
||||||
processRequest(options, &http_server) catch |e| {
|
processRequest(options, &http_server) catch |e| {
|
||||||
|
|
Loading…
Add table
Reference in a new issue