Skip to content

Commit 987fcfd

Browse files
committed
Disable WAI timeouts altogether
Depends on yesodweb/wai#1017 Closes #123
1 parent 4a433df commit 987fcfd

File tree

5 files changed

+22
-27
lines changed

5 files changed

+22
-27
lines changed

Diff for: .github/workflows/haskell-ci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ jobs:
228228
echo "package trailers-only-tutorial" >> cabal.project
229229
echo " ghc-options: -Werror=missing-methods" >> cabal.project
230230
cat >> cabal.project <<EOF
231+
source-repository-package
232+
type: git
233+
location: https://github.com/kazu-yamamoto/wai.git
234+
tag: 721782ad6e60f3ae4ff609b33c90e56921a4bddb
235+
subdir: time-manager
236+
231237
source-repository-package
232238
type: git
233239
location: https://github.com/google/proto-lens

Diff for: cabal.project

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ package grapesy
1818
benchmarks: True
1919
flags: +build-demo +build-stress-test
2020

21+
source-repository-package
22+
type: git
23+
location: https://github.com/kazu-yamamoto/wai.git
24+
tag: 721782ad6e60f3ae4ff609b33c90e56921a4bddb
25+
subdir: time-manager
26+
2127
-- proto-lens support for ghc 9.10
2228
-- https://github.com/google/proto-lens/pull/494
2329
source-repository-package

Diff for: cabal.project.ci

+6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ package conduit-tutorial
4141
package trailers-only-tutorial
4242
ghc-options: -Werror
4343

44+
source-repository-package
45+
type: git
46+
location: https://github.com/kazu-yamamoto/wai.git
47+
tag: 721782ad6e60f3ae4ff609b33c90e56921a4bddb
48+
subdir: time-manager
49+
4450
-- proto-lens support for ghc 9.10
4551
-- https://github.com/google/proto-lens/pull/494
4652
source-repository-package

Diff for: grapesy/src/Network/GRPC/Common/Compression.hs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{-# LANGUAGE CPP #-}
2-
31
-- | Public 'Compression' API
42
--
53
-- Intended for qualified import.

Diff for: grapesy/src/Network/GRPC/Util/HTTP2.hs

+4-25
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
{-# LANGUAGE CPP #-}
2-
3-
#include "MachDeps.h"
4-
51
module Network.GRPC.Util.HTTP2 (
62
-- * General auxiliary
73
fromHeaderTable
@@ -219,26 +215,9 @@ mkTlsSettings http2Settings keyLogger =
219215
withTimeManager :: (Time.Manager -> IO a) -> IO a
220216
withTimeManager = TimeManager.withManager (disableTimeout * 1_000_000)
221217

222-
-- | Work around the fact that we cannot disable timeouts in http2/http2-tls
218+
-- | Disable timeouts in http2/http2-tls
223219
--
224-
-- TODO: <https://github.com/well-typed/grapesy/issues/123>
225-
-- We need a proper solution for this.
220+
-- A value of 0 (or lower) disables timeouts altogether as of
221+
-- <https://github.com/yesodweb/wai/pull/1017>.
226222
disableTimeout :: Int
227-
disableTimeout =
228-
#if (WORD_SIZE_IN_BITS == 64)
229-
-- Set a really high timeout to effectively disable timeouts (100 years)
230-
--
231-
-- NOTE: We cannot use 'maxBound' here, because this value is multiplied
232-
-- by @1_000_000@ in 'Network.Run.TCP.Timeout.runTCPServerWithSocket'
233-
-- (in @network-run@).
234-
100 * 365 * 24 * 60 * 60
235-
#else
236-
#warning "Timeout for RPC messages is set to 30 minutes on 32-bit systems."
237-
#warning "See https://github.com/kazu-yamamoto/http2/issues/112"
238-
-- Unfortunately, the same trick does not work on 32-bit systems, where we
239-
-- simply don't have enough range. The maximum timeout we can support here
240-
-- is roughly 35 mins. We set it to 30 minutes exactly, to at least provide
241-
-- a clue if the timeout does hit (1_800_000_000 < 2_147_483_647).
242-
30 * 60
243-
#endif
244-
223+
disableTimeout = 0

0 commit comments

Comments
 (0)