Skip to content

Commit

Permalink
Use correct timeout value
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Feb 2, 2024
1 parent b4c692d commit 43d2d60
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/HummingbirdHTTP2/HTTP2Channel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ public struct HTTP2UpgradeChannel: HTTPChannelHandler {
case timer
case stream(HTTP1Channel.Value)
}
// sequence to trigger graceful shutdown
let (gracefulShutdownSequence, gracefulShutdownSource) = AsyncStream<Void>.makeStream()
let timerSequence = AsyncTimerSequence(interval: .seconds(1), clock: .continuous)
// timer sequence
let timerSequence = AsyncTimerSequence(interval: self.idleTimeout, clock: .continuous)
// merge multiplexer with graceful shutdown and timer
let mergedSequence = merge(
multiplexer.inbound.map { MergeResult.stream($0) },
timerSequence.map { _ in .timer },
Expand All @@ -126,6 +129,7 @@ public struct HTTP2UpgradeChannel: HTTPChannelHandler {
do {
try await withGracefulShutdownHandler {
try await withThrowingDiscardingTaskGroup { group in
// stream state.
let streamState = NIOLockedValueBox(HTTP2StreamState())
loop:
for try await element in mergedSequence
Expand Down

0 comments on commit 43d2d60

Please sign in to comment.