@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.
@@ -593,7 +593,14 @@ var Cluster = class {
593
593
  */
594
594
  bootWorkers = async (numWorkers) => {
595
595
  console.info(`Setting ${numWorkers} workers...`);
596
+ const staggerDelay = process.env.NODE_ENV === "production" ? 2e3 : 0;
596
597
  for (let i = 0; i < numWorkers; i++) {
598
+ if (i > 0 && staggerDelay > 0) {
599
+ await new Promise((resolve2) => setTimeout(resolve2, staggerDelay));
600
+ console.info(
601
+ `Starting worker ${i + 1}/${numWorkers} (staggered ${staggerDelay}ms)`
602
+ );
603
+ }
597
604
  cluster.fork();
598
605
  }
599
606
  cluster.on("online", (worker) => {
@@ -1712,17 +1719,23 @@ var loadIndex = async () => {
1712
1719
  console.log(
1713
1720
  `${workerInfo} loadIndex: registry cleared in ${Date.now() - clearStart}ms`
1714
1721
  );
1715
- console.log(`${workerInfo} loadIndex: clearing require cache...`);
1716
- const cacheStart = Date.now();
1717
- const appDir = `${process2.cwd()}/${getSourceDir()}`;
1718
- Object.keys(__require.cache).forEach((key) => {
1719
- if (key.startsWith(appDir)) {
1720
- delete __require.cache[key];
1721
- }
1722
- });
1723
- console.log(
1724
- `${workerInfo} loadIndex: require cache cleared in ${Date.now() - cacheStart}ms`
1725
- );
1722
+ if (process2.env.NODE_ENV !== "production") {
1723
+ console.log(`${workerInfo} loadIndex: clearing require cache...`);
1724
+ const cacheStart = Date.now();
1725
+ const appDir = `${process2.cwd()}/${getSourceDir()}`;
1726
+ Object.keys(__require.cache).forEach((key) => {
1727
+ if (key.startsWith(appDir)) {
1728
+ delete __require.cache[key];
1729
+ }
1730
+ });
1731
+ console.log(
1732
+ `${workerInfo} loadIndex: require cache cleared in ${Date.now() - cacheStart}ms`
1733
+ );
1734
+ } else {
1735
+ console.log(
1736
+ `${workerInfo} loadIndex: skipping cache clear in production mode`
1737
+ );
1738
+ }
1726
1739
  console.log(`${workerInfo} loadIndex: requiring index.ts...`);
1727
1740
  const requireStart = Date.now();
1728
1741
  __require(`${process2.cwd()}/${getSourceDir()}/index.ts`);