Skip to content

Commit bf1b6e3

Browse files
committed
fix: drop finally block and enable keepalive
Signed-off-by: Sam Gammon <[email protected]>
1 parent 09a428f commit bf1b6e3

File tree

7 files changed

+13
-11
lines changed

7 files changed

+13
-11
lines changed

dist/cleanup/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cleanup/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ const userAgent = userAgentSegments.join(' ')
101101

102102
export const httpClient = new http.HttpClient(userAgent, [], {
103103
allowRetries: true,
104-
maxRetries: 3
104+
maxRetries: 3,
105+
keepAlive: true
105106
})
106107

107108
/**

src/diagnostics.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ async function transmitEvent(event: ActionEvent<any>): Promise<void> {
143143
encoded,
144144
headers
145145
)
146-
if (res.message.statusCode !== 200 && res.message.statusCode !== 202) {
146+
if (
147+
res.message.statusCode !== http.HttpCodes.OK &&
148+
res.message.statusCode !== 202
149+
) {
147150
core.debug(`Event transmission failed: ${res.message.statusMessage}`)
148151
} else {
149152
core.debug(`Event transmission completed (ID: ${event.uuid})`)
@@ -216,5 +219,5 @@ export async function error(err: Error | unknown, fatal = true): Promise<void> {
216219
* Exit hook for making sure Sentry finishes reporting.
217220
*/
218221
export async function onExit(): Promise<void> {
219-
// Nothing to do.
222+
await Sentry.close(2000)
220223
}

src/main.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,11 @@ export async function entry(options?: Partial<Options>): Promise<void> {
579579

580580
try {
581581
await install(options || {}, true)
582+
await onExit()
582583
} catch (err) {
583584
core.warning(
584585
'Buildless failed to install; this build may not be accelerated. Please see CI logs for more information.'
585586
)
586-
} finally {
587-
await onExit()
588587
}
589588
}
590589

@@ -599,11 +598,10 @@ export async function cleanup(options?: Partial<Options>): Promise<void> {
599598
try {
600599
await postExecute(options)
601600
core.info(`Thanks for using Buildless. 🎉`)
601+
await onExit()
602602
} catch (err) {
603603
core.notice(
604604
'Cleanup stage for the Buildless action failed. Please see CI logs for more information.'
605605
)
606-
} finally {
607-
await onExit()
608606
}
609607
}

0 commit comments

Comments
 (0)