Skip to content

Commit 5c0b8f4

Browse files
committed
fix: increase default timeout
1 parent 176c3fd commit 5c0b8f4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

sql/pg_net.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ create or replace function net.http_get(
107107
-- key/values to be included in request headers
108108
headers jsonb default '{}'::jsonb,
109109
-- the maximum number of milliseconds the request may take before being cancelled
110-
timeout_milliseconds int default 2000
110+
timeout_milliseconds int default 5000
111111
)
112112
-- request_id reference
113113
returns bigint
@@ -152,7 +152,7 @@ create or replace function net.http_post(
152152
-- key/values to be included in request headers
153153
headers jsonb default '{"Content-Type": "application/json"}'::jsonb,
154154
-- the maximum number of milliseconds the request may take before being cancelled
155-
timeout_milliseconds int DEFAULT 2000
155+
timeout_milliseconds int DEFAULT 5000
156156
)
157157
-- request_id reference
158158
returns bigint
@@ -221,7 +221,7 @@ create or replace function net.http_delete(
221221
-- key/values to be included in request headers
222222
headers jsonb default '{}'::jsonb,
223223
-- the maximum number of milliseconds the request may take before being cancelled
224-
timeout_milliseconds int default 2000
224+
timeout_milliseconds int default 5000
225225
)
226226
-- request_id reference
227227
returns bigint

test/test_http_timeout.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ def test_http_get_timeout_reached(sess):
88

99
(request_id,) = sess.execute(text(
1010
"""
11-
select net.http_get(url := 'http://localhost:9999/p/200:b"wait%20for%20three%20seconds"pr,3');
11+
select net.http_get(url := 'http://localhost:9999/p/200:b"wait%20for%20six%20seconds"pr,6');
1212
"""
1313
)).fetchone()
1414

1515
sess.commit()
1616

17-
time.sleep(3.5)
17+
# wait for timeout
18+
time.sleep(6)
1819

1920
(response,) = sess.execute(
2021
text(
@@ -67,7 +68,8 @@ def test_many_slow_mixed_with_fast(sess):
6768

6869
sess.commit()
6970

70-
time.sleep(3)
71+
# wait for timeout
72+
time.sleep(6)
7173

7274
(status_code,count) = sess.execute(text(
7375
"""

0 commit comments

Comments
 (0)