Skip to content

Commit

Permalink
fix: Restored compatibility with cronometro. (nodejs#1406)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda authored and KhafraDev committed Jun 23, 2022
1 parent 924890b commit 6368343
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions benchmarks/benchmark.js
@@ -1,12 +1,12 @@
'use strict'

const cronometro = require('cronometro')
const { Writable } = require('stream')
const http = require('http')
const os = require('os')
const path = require('path')
const { table } = require('table')
const { Writable } = require('stream')
const { WritableStream } = require('stream/web')
const { isMainThread } = require('worker_threads')

const { Pool, Client, fetch, Agent, setGlobalDispatcher } = require('..')

Expand Down Expand Up @@ -258,19 +258,29 @@ if (process.env.PORT) {
}
}

cronometro(
experiments,
{
iterations,
errorThreshold,
print: false
},
(err, results) => {
if (err) {
throw err
async function main () {
const { cronometro } = await import('cronometro')

cronometro(
experiments,
{
iterations,
errorThreshold,
print: false
},
(err, results) => {
if (err) {
throw err
}

console.log(printResults(results))
dispatcher.destroy()
}
)
}

console.log(printResults(results))
dispatcher.destroy()
}
)
if (isMainThread) {
main()
} else {
module.exports = main
}

0 comments on commit 6368343

Please sign in to comment.