Skip to content

Commit

Permalink
Merge pull request #867 from krisxw/master
Browse files Browse the repository at this point in the history
Adding large data request site to provide additional testing for 866
  • Loading branch information
drewpc authored Feb 10, 2017
2 parents be40c32 + 1b1d1c7 commit 3eeb22b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react-server-test-pages/entrypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ module.exports = {
entry: "/bottleneck/dataRequests",
description: "Test if number of data requests on a page is a bottleneck",
},
BottleneckLargeDataRequests: {
entry: "/bottleneck/largeDataRequests",
description: "Test if large data requests on a page is a bottleneck",
},
BottleneckMiddleware: {
entry: "/bottleneck/middleware",
description: "Test if amount of middleware on a page is a bottleneck",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {ReactServerAgent, RootContainer, RootElement} from "react-server";
import "./colors/red.scss";
import "./colors/green.scss";

const elements = [];
/**
* This page is a smoke test to determine whether or not large data requests in
* a page are a performance bottleneck for react-server. It performs a hundred large data
* requests before returning a simple message. Metrics are created in the browser's console
* related to performance metrics (see react-server.core.ClientController).
*/
export default class LargeDataRequestsPage {

handleRoute() {
//Reset elements, then perform one hundred large, local data requests before returning
elements.length = 0;
for (var i = 1; i <= 100; i++) {
let current = i;
let promise = ReactServerAgent.get('/data/delay')
.query({ big: 10000 })
.then(response => response.body);
elements.push(<RootElement when={promise}><div>10K Data request number {current} complete.</div></RootElement>);
}
return { code: 200 };
}

getElements() {
return [
<div className="red-thing">Data requests starting...</div>,
<RootContainer>
{elements}
</RootContainer>,
<div className="green-thing">Content should be above me.</div>,
];
}
}

0 comments on commit 3eeb22b

Please sign in to comment.