File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1588,10 +1588,11 @@ const TestOptions = struct {
15881588 return error .HeaderOrValueNotFound ;
15891589 }
15901590 fn waitForReady (self : * Self ) ! void {
1591- // While this doesn't return an error, we can use !void
1592- // to prepare for addition of timeout
1593- while (! self .server_ready )
1591+ // Set 1 minute timeout...this is way longer than necessary
1592+ var remaining_iters : isize = std . time . ns_per_min / 100 ;
1593+ while (! self .server_ready and remaining_iters > 0 ) : ( remaining_iters -= 1 )
15941594 std .time .sleep (100 );
1595+ if (! self .server_ready ) return error .TestServerTimeoutWaitingForReady ;
15951596 }
15961597};
15971598
@@ -1619,6 +1620,7 @@ fn threadMain(options: *TestOptions) !void {
16191620 // var aa = arena.allocator();
16201621 // We're in control of all requests/responses, so this flag will tell us
16211622 // when it's time to shut down
1623+ defer options .server_ready = true ; // In case remaining_requests = 0, we don't want to wait forever
16221624 while (options .server_remaining_requests > 0 ) {
16231625 options .server_remaining_requests -= 1 ;
16241626 processRequest (options , & http_server ) catch | e | {
You can’t perform that action at this time.
0 commit comments