Skip to content

Commit

Permalink
Use cached thread pool for http client
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Oct 1, 2023
1 parent b8de976 commit af32e6b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/groovy/io/seqera/wave/http/HttpClientFactory.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import io.seqera.wave.util.CustomThreadFactory
@CompileStatic
class HttpClientFactory {

static private ExecutorService fixedThreadPool = Executors.newFixedThreadPool(64, new CustomThreadFactory("HttpClientThread"))
static private ExecutorService threadPool = Executors.newCachedThreadPool(new CustomThreadFactory("HttpClientThread"))

static private Duration timeout = Duration.ofSeconds(20)

Expand Down Expand Up @@ -77,7 +77,7 @@ class HttpClientFactory {
.version(HttpClient.Version.HTTP_1_1)
.followRedirects(HttpClient.Redirect.NORMAL)
.connectTimeout(timeout)
.executor(fixedThreadPool)
.executor(threadPool)
.build()
log.debug "Creating new followRedirectsHttpClient: $result"
return result
Expand All @@ -88,7 +88,7 @@ class HttpClientFactory {
.version(HttpClient.Version.HTTP_1_1)
.followRedirects(HttpClient.Redirect.NEVER)
.connectTimeout(timeout)
.executor(fixedThreadPool)
.executor(threadPool)
.build()
log.debug "Creating new neverRedirectsHttpClient: $result"
return result
Expand Down

0 comments on commit af32e6b

Please sign in to comment.