From 526e60b04cc0cc1cdaf5a90b1329328c8747b876 Mon Sep 17 00:00:00 2001 From: Fang Date: Tue, 28 Sep 2021 20:50:55 +0400 Subject: [PATCH] strandio: fail when http request gets cancelled Instead of waiting for a proper response. Iris doesn't currently retry! Also updates docket to detect this case and retry appropriately. --- pkg/arvo/sys/vane/iris.hoon | 1 + pkg/base-dev/lib/strandio.hoon | 8 ++++++++ pkg/garden/app/docket.hoon | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/sys/vane/iris.hoon b/pkg/arvo/sys/vane/iris.hoon index 0f9e7fcee8..01e80eb561 100644 --- a/pkg/arvo/sys/vane/iris.hoon +++ b/pkg/arvo/sys/vane/iris.hoon @@ -332,6 +332,7 @@ :: :: TODO: We should gracefully retry on restart instead of just sending a :: cancel. + :: TODO we might not want to do that though! :: =/ moves=(list move) %+ turn ~(tap by connection-by-duct.state.ax) diff --git a/pkg/base-dev/lib/strandio.hoon b/pkg/base-dev/lib/strandio.hoon index b8f2ea2030..3db48a4882 100644 --- a/pkg/base-dev/lib/strandio.hoon +++ b/pkg/base-dev/lib/strandio.hoon @@ -386,6 +386,14 @@ |= tin=strand-input:strand ?+ in.tin `[%skip ~] ~ `[%wait ~] + :: + [~ %sign [%request ~] %iris %http-response %cancel *] + ::NOTE iris does not (yet?) retry after cancel, so it means failure + :- ~ + :+ %fail + %http-request-cancelled + ['http request was cancelled by the runtime']~ + :: [~ %sign [%request ~] %iris %http-response %finished *] `[%done client-response.sign-arvo.u.in.tin] == diff --git a/pkg/garden/app/docket.hoon b/pkg/garden/app/docket.hoon index ce9caadb52..f6c746c4f6 100644 --- a/pkg/garden/app/docket.hoon +++ b/pkg/garden/app/docket.hoon @@ -292,7 +292,7 @@ ?+ p.cage.sign `state %thread-fail =+ !<([=term =tang] q.cage.sign) - ?. =(term %cancelled) + ?. |(=(term %cancelled) =(term %http-request-cancelled)) =. charges (new-chad:cha hung+'glob-failed') :- ~[add-fact:cha] ((slog leaf+"docket: thread failed;" leaf+ tang) state)