Skip to content

Commit

Permalink
Benchmarks: No need to guard against unhandled promise rejections (#5025
Browse files Browse the repository at this point in the history
)
  • Loading branch information
watson authored Jan 7, 2025
1 parent b4f99e8 commit 7378bff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 26 deletions.
28 changes: 11 additions & 17 deletions benchmark/sirun/run-all-variants.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,19 @@ const metaJson = require(path.join(process.cwd(), 'meta.json'))
const env = Object.assign({}, process.env, { DD_TRACE_STARTUP_LOGS: 'false' })

;(async () => {
try {
if (metaJson.variants) {
const variants = metaJson.variants
for (const variant in variants) {
const variantEnv = Object.assign({}, env, { SIRUN_VARIANT: variant })
await exec('sirun', ['meta-temp.json'], { env: variantEnv, stdio: getStdio() })
}
} else {
await exec('sirun', ['meta-temp.json'], { env, stdio: getStdio() })
if (metaJson.variants) {
const variants = metaJson.variants
for (const variant in variants) {
const variantEnv = Object.assign({}, env, { SIRUN_VARIANT: variant })
await exec('sirun', ['meta-temp.json'], { env: variantEnv, stdio: getStdio() })
}
} else {
await exec('sirun', ['meta-temp.json'], { env, stdio: getStdio() })
}

try {
fs.unlinkSync(path.join(process.cwd(), 'meta-temp.json'))
} catch (e) {
// it's ok if we can't delete a temp file
}
try {
fs.unlinkSync(path.join(process.cwd(), 'meta-temp.json'))
} catch (e) {
setImmediate(() => {
throw e // Older Node versions don't fail on uncaught promise rejections.
})
// it's ok if we can't delete a temp file
}
})()
10 changes: 1 addition & 9 deletions benchmark/sirun/run-one-variant.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,4 @@ process.env.DD_INSTRUMENTATION_TELEMETRY_ENABLED = 'false'

const env = Object.assign({}, process.env, { DD_TRACE_STARTUP_LOGS: 'false' })

;(async () => {
try {
await exec('sirun', ['meta-temp.json'], { env, stdio: getStdio() })
} catch (e) {
setImmediate(() => {
throw e // Older Node versions don't fail on uncaught promise rejections.
})
}
})()
exec('sirun', ['meta-temp.json'], { env, stdio: getStdio() })

0 comments on commit 7378bff

Please sign in to comment.