From 2d8d40c08a387460cc4c167203436ae5bdfc3b25 Mon Sep 17 00:00:00 2001 From: Jacob Eliat-Eliat Date: Fri, 15 Nov 2024 15:33:31 +0100 Subject: [PATCH] read timeeout duration inf --- src/main/scala/cognite/spark/v1/FileContentRelation.scala | 2 ++ .../scala/cognite/spark/v1/SttpClientBackendFactory.scala | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/scala/cognite/spark/v1/FileContentRelation.scala b/src/main/scala/cognite/spark/v1/FileContentRelation.scala index ed67f24e1..2c297fcdd 100644 --- a/src/main/scala/cognite/spark/v1/FileContentRelation.scala +++ b/src/main/scala/cognite/spark/v1/FileContentRelation.scala @@ -19,6 +19,7 @@ import sttp.client3.{SttpBackend, UriContext, asStreamUnsafe, basicRequest} import sttp.model.Uri import scala.collection.immutable._ +import scala.concurrent.duration.Duration //The trait exist for testing purposes trait WithSizeLimit { @@ -105,6 +106,7 @@ class FileContentRelation(config: RelationConfig, fileExternalId: String, inferS val request = basicRequest .get(link) .response(asStreamUnsafe(Fs2Streams[IO])) + .readTimeout(Duration.Inf) Stream.eval(backend.send(request)).flatMap { response => response.body match { diff --git a/src/main/scala/cognite/spark/v1/SttpClientBackendFactory.scala b/src/main/scala/cognite/spark/v1/SttpClientBackendFactory.scala index f6bf190e8..30c62478a 100644 --- a/src/main/scala/cognite/spark/v1/SttpClientBackendFactory.scala +++ b/src/main/scala/cognite/spark/v1/SttpClientBackendFactory.scala @@ -27,7 +27,10 @@ object SttpClientBackendFactory { .setThreadFactory(clientThreadFactory) .setNettyTimer(new HashedWheelTimer(timerThreadFactory)) //Timeout override for potentially long stream operation - requestTimeoutMs.foreach(options.setRequestTimeout) + requestTimeoutMs.foreach( + options.setRequestTimeout + ) + options.setTimeout options } )