fix: node-worker-threads-pool needs inline imports in code block
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 25 Jun 2023 14:28:20 +0000 (16:28 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 25 Jun 2023 14:28:20 +0000 (16:28 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
benchmarks/versus-external-pools/functions/function-to-bench.mjs

index 4705273c07e1bd1437d84f75d2a74782747d8e11..26f56d04dfdd232e10ffff4b3830494920a5ae96 100644 (file)
@@ -1,6 +1,3 @@
-import crypto from 'crypto'
-import fs from 'fs'
-
 /**
  * The worker function to execute during pools benchmarks.
  * NOTE: This function requires to be self-contained, thread-safe and re-entrant.
@@ -8,6 +5,8 @@ import fs from 'fs'
  * @returns {*} The result.
  */
 export default function functionToBench (data) {
+  const crypto = import('crypto')
+  const fs = import('fs')
   const TaskTypes = {
     CPU_INTENSIVE: 'CPU_INTENSIVE',
     IO_INTENSIVE: 'IO_INTENSIVE'