Skip to content

Commit

Permalink
fix: remove timeout_milliseconds option
Browse files Browse the repository at this point in the history
It's ignored for now
  • Loading branch information
soedirgo committed Jul 30, 2021
1 parent 3d52e77 commit 31fe586
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
8 changes: 2 additions & 6 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ net.http_get(
-- key/value pairs to be url encoded and appended to the `url`
params jsonb default '{}'::jsonb,
-- key/values to be included in request headers
headers jsonb default '{}'::jsonb,
-- the maximum number of milliseconds the request may take before being cancelled
timeout_milliseconds int default 1000
headers jsonb default '{}'::jsonb
)
-- request_id reference
returns bigint
Expand Down Expand Up @@ -61,9 +59,7 @@ net.http_post(
-- key/value pairs to be url encoded and appended to the `url`
params jsonb default '{}'::jsonb,
-- key/values to be included in request headers
headers jsonb default '{"Content-Type": "application/json"}'::jsonb,
-- the maximum number of milliseconds the request may take before being cancelled
timeout_milliseconds int default 1000
headers jsonb default '{"Content-Type": "application/json"}'::jsonb
)
-- request_id reference
returns bigint
Expand Down
19 changes: 6 additions & 13 deletions sql/pg_net--0.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ create table net.http_request_queue(
url text not null,
headers jsonb not null,
body bytea,
timeout_milliseconds int not null,
created timestamptz not null default now()
);

Expand Down Expand Up @@ -92,9 +91,7 @@ create or replace function net.http_get(
-- key/value pairs to be url encoded and appended to the `url`
params jsonb default '{}'::jsonb,
-- key/values to be included in request headers
headers jsonb default '{}'::jsonb,
-- the maximum number of milliseconds the request may take before being cancelled
timeout_milliseconds int default 1000
headers jsonb default '{}'::jsonb
)
-- request_id reference
returns bigint
Expand All @@ -112,12 +109,11 @@ begin
from jsonb_each_text(params);

-- Add to the request queue
insert into net.http_request_queue(method, url, headers, timeout_milliseconds)
insert into net.http_request_queue(method, url, headers)
values (
'GET',
net._encode_url_with_params_array(url, params_array),
headers,
timeout_milliseconds
headers
)
returning id
into request_id;
Expand All @@ -136,9 +132,7 @@ create or replace function net.http_post(
-- key/value pairs to be url encoded and appended to the `url`
params jsonb default '{}'::jsonb,
-- key/values to be included in request headers
headers jsonb default '{"Content-Type": "application/json"}'::jsonb,
-- the maximum number of milliseconds the request may take before being cancelled
timeout_milliseconds int DEFAULT 1000
headers jsonb default '{"Content-Type": "application/json"}'::jsonb
)
-- request_id reference
returns bigint
Expand Down Expand Up @@ -186,13 +180,12 @@ begin
jsonb_each_text(params);

-- Add to the request queue
insert into net.http_request_queue(method, url, headers, body, timeout_milliseconds)
insert into net.http_request_queue(method, url, headers, body)
values (
'POST',
net._encode_url_with_params_array(url, params_array),
headers,
body::text::bytea,
timeout_milliseconds
body::text::bytea
)
returning id
into request_id;
Expand Down

0 comments on commit 31fe586

Please sign in to comment.