Files
Tobias KoppersandGitHub f9795fdd26 improve static generation UX (#27171)
#### improve export spinner

update at least once a minute in non-tty
update progress regularly when using the spinner
decrease frequency of the spinner (windows console output is expensive)

#### restart static page generation and collecting page data worker pools when hanging

when for 1 minute no activity happens on the worker pool, restart it
log a warning for hanging jobs

#### add page generation duration to summary tree

![image](https://user-images.githubusercontent.com/1365881/125750454-8845f1b1-faf0-4598-b7a4-ea796b884691.png)

for `[+n more pages]` is will show `(avg 321 ms)` when the average is over the threshold.
It will allocate 8 lines for preview pages (instead of 4) when they contain slow pages

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [x] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-07-16 09:21:44 +00:00

35 lines
789 B
JavaScript

export default ({ renderDuration }) => {
const target = Date.now() + (+renderDuration || 200)
while (Date.now() < target);
return <div>{renderDuration}</div>
}
export function getStaticPaths() {
return {
paths: [
[2000, 10],
[5, 5],
[25, 25],
[20, 20],
[10, 10],
[15, 15],
[15, 10],
[10, 10],
[300, 10],
[10, 1000],
].map(([propsDuration, renderDuration]) => ({
params: {
renderDuration: `${renderDuration}`,
propsDuration: `${propsDuration}`,
},
})),
fallback: true,
}
}
export async function getStaticProps({ params }) {
const { renderDuration, propsDuration } = params
await new Promise((r) => setTimeout(r, +propsDuration))
return { props: { renderDuration } }
}