Skip to content

Commit a3f5a1e

Browse files
committed
test(fasthttp): wait for prealloc worker exit
1 parent 1d6739d commit a3f5a1e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

vlib/fasthttp/fasthttp_linux_prealloc_regression_test.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ fn test_prealloc_async_write_state_outlives_worker() ! {
3131
C.close(wakeup_fd)
3232
}
3333
command_ch := chan LoopCommand{cap: 1}
34-
dispatch_request_async(server, sockets[0], 'GET / HTTP/1.1\r\nHost: localhost\r\n\r\n'.bytes(),
35-
command_ch, wakeup_fd)
34+
server.begin_request()
35+
worker := spawn process_request_async(server, sockets[0],
36+
'GET / HTTP/1.1\r\nHost: localhost\r\n\r\n'.bytes(), command_ch, wakeup_fd)
3637

3738
mut cmd := LoopCommand{}
3839
select {
@@ -44,8 +45,7 @@ fn test_prealloc_async_write_state_outlives_worker() ! {
4445
return
4546
}
4647
}
47-
// The worker must have exited before the event loop consumes its state.
48-
time.sleep(50 * time.millisecond)
48+
worker.wait()
4949
assert cmd.kind == .complete_response
5050
assert cmd.state != unsafe { nil }
5151
assert cmd.state.content.len > 0

0 commit comments

Comments
 (0)