Permalink
Browse files

``@phenomic/core``: Fix issue when too many files are being transform…

…ed and contains undefined or null by adding a concurrency limit to hit API
  • Loading branch information...
MoOx committed Oct 19, 2017
1 parent 928d677 commit bc97c107aca59f46097e7b77cd6961d0f51462ea
Showing with 15 additions and 5 deletions.
  1. +3 −0 flow/interfaces/shitty-libdefs.js
  2. +1 −0 packages/core/package.json
  3. +7 −5 packages/core/src/commands/build.js
  4. +4 −0 yarn.lock
@@ -38,3 +38,6 @@ declare module "emotion-server" {
declare module "react-emotion" {
declare var exports: any;
}
declare module "p-map" {
declare var exports: any;
}
@@ -27,6 +27,7 @@
"levelup": "^1.3.3",
"log-symbols": "^1.0.2",
"mkdirp": "^0.5.1",
"p-map": "^1.2.0",
"path-to-regexp": "^1.7.0",
"rimraf": "^2.5.4",
"sane": "^1.7.0",
@@ -6,6 +6,7 @@ import jsonFetch from "simple-json-fetch";
import getPort from "get-port";
import createURL from "@phenomic/api-client/lib/url";
import rimraf from "rimraf";
import pMap from "p-map";
import { oneShot } from "../watch";
import processFile from "../injection/processFile";
@@ -101,7 +102,7 @@ async function prerenderFileAndDependencies({
phenomicFetch,
location
});
debug(`'${location}': files & deps collected`);
debug(`'${location}': files & deps collected`, files);
return Promise.all(
files.map(file =>
writeFile(
@@ -164,17 +165,18 @@ async function build(config) {
`${logSymbols.warning} No URLs resolved. You should probably double-check your routes. If you are using a single '*' route, you need to add an '/' to get a least a static entry point.`
);
}
await Promise.all(
urls.map(location =>
await pMap(
urls,
location =>
prerenderFileAndDependencies({
config,
renderer,
app,
assets,
phenomicFetch,
location
})
)
}),
{ concurrency: 50 }
);
console.log("📃 Pre-rendering finished " + (Date.now() - lastStamp) + "ms");
lastStamp = Date.now();
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit bc97c10

Please sign in to comment.