Skip to content

Commit 48bf0fb

Browse files
committed
fix: timeout
1 parent 6144de5 commit 48bf0fb

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

package-lock.json

Lines changed: 0 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/save.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import { UploadOptions } from '@actions/cache/lib/options'
66

77
import {
88
ObjectStoreOptions,
9-
getClient,
10-
getBucket,
11-
checkPaths,
9+
ValidationError,
1210
checkKey,
13-
ValidationError
11+
checkPaths,
12+
getBucket,
13+
getClient,
1414
} from './utils'
1515

1616
/**

src/utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { CompressionMethod } from '@actions/cache/lib/internal/constants'
22
import * as utils from '@actions/cache/lib/internal/cacheUtils'
33
import * as minio from 'minio'
4+
import * as http from 'http'
5+
import * as https from 'https'
46
import yn from 'yn'
57

68
export interface ObjectStoreOptions {
@@ -86,6 +88,14 @@ export async function listObjects(
8688
}
8789

8890
export function getClient(options: ObjectStoreOptions): minio.Client {
91+
let useSSL = options.useSSL ?? yn(process.env['ALT_GHA_CACHE_USE_SSL']) ?? true
92+
let httpsTransportAgent = new https.Agent({
93+
timeout: 120000,
94+
})
95+
let httpTransportAgent = new http.Agent({
96+
timeout: 120000,
97+
})
98+
let transportAgent = useSSL ? httpsTransportAgent : httpTransportAgent
8999
return new minio.Client({
90100
endPoint:
91101
options.endPoint ??
@@ -112,7 +122,8 @@ export function getClient(options: ObjectStoreOptions): minio.Client {
112122
process.env['ALT_GHA_CACHE_REGION'] ??
113123
process.env['AWS_REGION'] ??
114124
'',
115-
useSSL: options.useSSL ?? yn(process.env['ALT_GHA_CACHE_USE_SSL']) ?? true
125+
useSSL: useSSL,
126+
transportAgent: transportAgent
116127
})
117128
}
118129

0 commit comments

Comments
 (0)