about summary refs log tree commit diff
path: root/maintainers
diff options
context:
space:
mode:
authorDennis Gosnell <cdep.illabout@gmail.com>2023-11-02 10:27:03 +0900
committerDennis Gosnell <cdep.illabout@gmail.com>2023-11-02 10:29:42 +0900
commitf754973d145da2e9b5c43e4dda38721a0aaf3145 (patch)
tree128a7d8abb3216bb82f4f5434b17e612111f78dc /maintainers
parent9d1ed665f7378480375dc1957e9d314b0feb61f4 (diff)
haskell hydra-report: bump timeout for all requests to Hydra
In practice, almost all requests to Hydra take longer than the default
timeout of 30 seconds.

This commit bumps all requests to the max timeout of 15 minutes.  This
should hopefully make the hdyra-report.hs script more reliable and fail
less.
Diffstat (limited to 'maintainers')
-rwxr-xr-xmaintainers/scripts/haskell/hydra-report.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/maintainers/scripts/haskell/hydra-report.hs b/maintainers/scripts/haskell/hydra-report.hs
index 5573e5e5afc6e..2ce3ecb2ae70a 100755
--- a/maintainers/scripts/haskell/hydra-report.hs
+++ b/maintainers/scripts/haskell/hydra-report.hs
@@ -187,7 +187,7 @@ getBuildReports opt = runReq defaultHttpConfig do
 
 getEvalBuilds :: HydraSlownessWorkaroundFlag -> Int -> Req (Seq Build)
 getEvalBuilds NoHydraSlownessWorkaround id =
-  hydraJSONQuery (responseTimeout 900000000) ["eval", showT id, "builds"]
+  hydraJSONQuery mempty ["eval", showT id, "builds"]
 getEvalBuilds HydraSlownessWorkaround id = do
   Eval{builds} <- hydraJSONQuery mempty [ "eval", showT id ]
   forM builds $ \buildId -> do
@@ -195,14 +195,15 @@ getEvalBuilds HydraSlownessWorkaround id = do
     hydraJSONQuery mempty [ "build", showT buildId ]
 
 hydraQuery :: HttpResponse a => Proxy a -> Option 'Https -> [Text] -> Req (HttpResponseBody a)
-hydraQuery responseType option query =
-   responseBody
-      <$> req
-         GET
-         (foldl' (/:) (https "hydra.nixos.org") query)
-         NoReqBody
-         responseType
-         (header "User-Agent" "hydra-report.hs/v1 (nixpkgs;maintainers/scripts/haskell) pls fix https://github.com/NixOS/nixos-org-configurations/issues/270" <> option)
+hydraQuery responseType option query = do
+  let customHeaderOpt =
+        header
+          "User-Agent"
+          "hydra-report.hs/v1 (nixpkgs;maintainers/scripts/haskell) pls fix https://github.com/NixOS/nixos-org-configurations/issues/270"
+      customTimeoutOpt = responseTimeout 900_000_000 -- 15 minutes
+      opts = customHeaderOpt <> customTimeoutOpt <> option
+      url = foldl' (/:) (https "hydra.nixos.org") query
+  responseBody <$> req GET url NoReqBody responseType opts
 
 hydraJSONQuery :: FromJSON a => Option 'Https -> [Text] -> Req a
 hydraJSONQuery = hydraQuery jsonResponse