Skip to content

Commit

Permalink
fix some coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
weiwei-lin committed Jan 31, 2017
1 parent 372eeb9 commit efef4a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.

This file was deleted.

12 changes: 6 additions & 6 deletions lighthouse-cli/performance-experiment/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ const parse = require('url').parse;
const opn = require('opn');
const log = require('../../lighthouse-core/lib/log');
const lighthouse = require('../../lighthouse-core');
const ExperimentDatabase = require('./experiment-database');
const ExperimentDatabase = require('./experiment-database/database');
const PerfXReportGenerator = require('./report/perf-x-report-generator');

let database;
let defaultReportId;
let fallbackReportId;
/**
* Start the server with an arbitrary port and open report page in the default browser.
* @param {!Object} params A JSON contains lighthouse parameters
Expand All @@ -48,7 +48,7 @@ function hostExperiment(params, results) {
return new Promise(resolve => {
database = new ExperimentDatabase(params.url, params.config);
const id = database.saveData(params.flags, results);
defaultReportId = id;
fallbackReportId = id;

const server = http.createServer(requestHandler);
server.listen(0);
Expand Down Expand Up @@ -97,7 +97,7 @@ function requestHandler(request, response) {

function reportRequestHandler(request, response) {
try {
const id = request.parsedUrl.query.id || defaultReportId;
const id = request.parsedUrl.query.id || fallbackReportId;

const reportsMetadata = Object.keys(database.timeStamps).map(key => {
const generatedTime = database.timeStamps[key];
Expand All @@ -124,15 +124,15 @@ function reportRequestHandler(request, response) {
function flagsRequestHandler(request, response) {
try {
response.writeHead(200, {'Content-Type': 'text/json'});
response.end(JSON.stringify(database.getFlags(request.parsedUrl.query.id || defaultReportId)));
response.end(JSON.stringify(database.getFlags(request.parsedUrl.query.id || fallbackReportId)));
} catch (err) {
throw new HTTPError(404);
}
}

function rerunRequestHandler(request, response) {
try {
const flags = database.getFlags(request.parsedUrl.query.id || defaultReportId);
const flags = database.getFlags(request.parsedUrl.query.id || fallbackReportId);
let message = '';
request.on('data', data => message += data);

Expand Down

0 comments on commit efef4a2

Please sign in to comment.