Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: try making client reusable #1877

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ jobs:
version:
- "5.9"
- "6.0"
iteration: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ import protocol AWSClientRuntime.AWSServiceError

final class TranscribeStreamingTests: XCTestCase {

// Shared TranscribeStreamingClient instance
private var client: TranscribeStreamingClient!

override func setUp() async throws {
try await super.setUp()
client = try TranscribeStreamingClient(region: "us-west-2")
}

// MARK: - Test transcription

func test_single_streamTranscription() async throws {
try await attempt()
}

#if !os(Linux)

// Concurrent stream transcription frequently fails on the CRT HTTP client with errors
// such as:
// code: 2087, message: "Stream acquisition failed because stream manager failed to acquire a connection"
Expand All @@ -32,8 +38,6 @@ final class TranscribeStreamingTests: XCTestCase {
try await repeatConcurrently(count: 25, test: attempt)
}

#endif

// MARK: - Private / implementation methods

private func performStreamTranscription() async throws {
Expand All @@ -52,8 +56,6 @@ final class TranscribeStreamingTests: XCTestCase {
let dataRate = Double(audioDataSize) / duration
let delay = Double(chunkSize) / dataRate

let client = try TranscribeStreamingClient(region: "us-west-2")

let audioStream = AsyncThrowingStream<TranscribeStreamingClientTypes.AudioStream, Error> { continuation in
Task {
var currentStart = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public enum AWSRetryErrorInfoProvider: RetryErrorInfoProvider {
private static let transientCRTErrorCodes: [Int32] = [
2058, // httpConnectionClosed
2070, // httpServerClosed
2087, // AWS_ERROR_HTTP_STREAM_MANAGER_CONNECTION_ACQUIRE_FAILURE
2077, // AWS_ERROR_HTTP_RST_STREAM_RECEIVED
]

// HTTP status codes that the Retry Behavior 2.0 specification say should be treated as transient errors.
Expand Down
Loading