@@ -56,33 +56,29 @@ def test_many_slow_mixed_with_fast(sess):
56
56
"""many fast responses finish despite being mixed with slow responses, the fast responses will wait the timeout duration"""
57
57
58
58
sess .execute (text (
59
- """
60
- select
61
- net.http_get(url := 'http://localhost:8080/pathological?status=200')
62
- , net.http_get(url := 'http://localhost:8080/pathological?status=200&delay=10' )
63
- , net.http_get(url := 'http://localhost:8080/pathological?status=200')
64
- , net.http_get(url := 'http://localhost:8080/pathological?status=200&delay=10' )
65
- from generate_series(1,25) _;
59
+ """
60
+ select
61
+ net.http_get(url := 'http://localhost:8080/pathological?status=200')
62
+ , net.http_get(url := 'http://localhost:8080/pathological?status=200&delay=2', timeout_milliseconds := 1000 )
63
+ , net.http_get(url := 'http://localhost:8080/pathological?status=200')
64
+ , net.http_get(url := 'http://localhost:8080/pathological?status=200&delay=2', timeout_milliseconds := 1000 )
65
+ from generate_series(1,25) _;
66
66
"""
67
67
))
68
68
69
69
sess .commit ()
70
70
71
- # wait for timeout
72
- time .sleep (6 )
71
+ # wait for timeouts
72
+ time .sleep (3 )
73
73
74
- (status_code , count ) = sess .execute (text (
74
+ (request_successes , request_timeouts ) = sess .execute (text (
75
75
"""
76
- select status_code, count(*) from net._http_response where status_code = 200 group by status_code;
76
+ select
77
+ count(*) filter (where error_msg is null and status_code = 200) as request_successes,
78
+ count(*) filter (where error_msg is not null and error_msg like 'Timeout was reached') as request_timeouts
79
+ from net._http_response;
77
80
"""
78
81
)).fetchone ()
79
82
80
- assert status_code == 200
81
- assert count == 50
82
-
83
- (timed_out_count ,) = sess .execute (text (
84
- """
85
- select count(*) from net._http_response where error_msg ilike '%Timeout%';
86
- """
87
- )).fetchone ()
88
- assert timed_out_count == 50
83
+ assert request_successes == 50
84
+ assert request_timeouts == 50
0 commit comments