Skip to content

Commit

Permalink
Increased the S3 request handler timeout and maxSockets (#868)
Browse files Browse the repository at this point in the history
The client build process was starting to frequently get clogged when
pushing files to S3, which was leading to index.html not being
pushed, but its child index.js files were getting pruned.

AWS documentation suggested increasing number of sockets in these
situations. Added some logging so if it continues to happen, it's
easier to detect why this isn't being flagged as an error by
record-build-error.
  • Loading branch information
barankyle authored Dec 19, 2024
1 parent cb1b959 commit dc46c2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/server-core/src/media/storageprovider/s3.storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export class S3Provider implements StorageProviderInterface {
fs.writeFileSync(credentialsPath, Buffer.from(awsCredentials))

this.provider = new S3Client({
requestHandler: {
requestTimeout: 5_000,
httpsAgent: { maxSockets: 300 }
},
credentials: fromIni({
profile: config.aws.s3.roleArn ? 'role' : 'default',
filepath: credentialsPath
Expand Down
5 changes: 5 additions & 0 deletions scripts/record-build-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ cli.main(async () => {
const buildErrors = fs.readFileSync(`${options.service}-build-error.txt`).toString()
const builderRun = fs.readFileSync('builder-run.txt').toString()
if (options.isDocker) {
console.log('isDocker is true')
const cacheMissRegex = new RegExp(`${options.service}:latest_${process.env.RELEASE_NAME}_cache: not found`)
console.log('exit code 1', /exit code: 1/.test(buildErrors))
console.log('Non cache miss ERROR', /ERROR:/.test(buildErrors) && !cacheMissRegex.test(buildErrors))
if (/exit code: 1/.test(buildErrors) || (/ERROR:/.test(buildErrors) && !cacheMissRegex.test(buildErrors))) {
console.log('Recording error')
const combinedLogs = `Docker task that errored: ${options.service}\n\nTask logs:\n\n${buildErrors}`
await knexClient
.from<BuildStatusType>(buildStatusPath)
Expand All @@ -76,6 +80,7 @@ cli.main(async () => {
logs: combinedLogs,
dateEnded: dateNow
})
console.log('exiting with code 1')
cli.exit(1)
} else cli.exit(0)
} else {
Expand Down

0 comments on commit dc46c2e

Please sign in to comment.