@514labs/moose-lib 0.6.267-ci-6-g7e4e6a41 → 0.6.267-ci-7-g09e4deda

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -606,7 +606,14 @@ var Cluster = class {
606
606
  */
607
607
  bootWorkers = async (numWorkers) => {
608
608
  console.info(`Setting ${numWorkers} workers...`);
609
+ const staggerDelay = process.env.NODE_ENV === "production" ? 2e3 : 0;
609
610
  for (let i = 0; i < numWorkers; i++) {
611
+ if (i > 0 && staggerDelay > 0) {
612
+ await new Promise((resolve2) => setTimeout(resolve2, staggerDelay));
613
+ console.info(
614
+ `Starting worker ${i + 1}/${numWorkers} (staggered ${staggerDelay}ms)`
615
+ );
616
+ }
610
617
  import_node_cluster.default.fork();
611
618
  }
612
619
  import_node_cluster.default.on("online", (worker) => {
@@ -1725,17 +1732,23 @@ var loadIndex = async () => {
1725
1732
  console.log(
1726
1733
  `${workerInfo} loadIndex: registry cleared in ${Date.now() - clearStart}ms`
1727
1734
  );
1728
- console.log(`${workerInfo} loadIndex: clearing require cache...`);
1729
- const cacheStart = Date.now();
1730
- const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
1731
- Object.keys(require.cache).forEach((key) => {
1732
- if (key.startsWith(appDir)) {
1733
- delete require.cache[key];
1734
- }
1735
- });
1736
- console.log(
1737
- `${workerInfo} loadIndex: require cache cleared in ${Date.now() - cacheStart}ms`
1738
- );
1735
+ if (import_process.default.env.NODE_ENV !== "production") {
1736
+ console.log(`${workerInfo} loadIndex: clearing require cache...`);
1737
+ const cacheStart = Date.now();
1738
+ const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
1739
+ Object.keys(require.cache).forEach((key) => {
1740
+ if (key.startsWith(appDir)) {
1741
+ delete require.cache[key];
1742
+ }
1743
+ });
1744
+ console.log(
1745
+ `${workerInfo} loadIndex: require cache cleared in ${Date.now() - cacheStart}ms`
1746
+ );
1747
+ } else {
1748
+ console.log(
1749
+ `${workerInfo} loadIndex: skipping cache clear in production mode`
1750
+ );
1751
+ }
1739
1752
  console.log(`${workerInfo} loadIndex: requiring index.ts...`);
1740
1753
  const requireStart = Date.now();
1741
1754
  require(`${import_process.default.cwd()}/${getSourceDir()}/index.ts`);