Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(lantern): cleanup Simulator construction #4910

Merged
merged 3 commits into from
Apr 5, 2018

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Apr 2, 2018

final touches waiting on #4894 but mostly independent touched up!

this PR cleans up the creation of Simulator objects and their usage by creating a new computed artifact that reads throttling info from the new settings object

@patrickhulce patrickhulce force-pushed the cleanup_simulator_creation branch from 0767228 to 1e2e921 Compare April 4, 2018 22:44
@patrickhulce
Copy link
Collaborator Author

@brendankenny thoughts here?

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few things but I think looking good


class SimulatorArtifact extends ComputedArtifact {
get name() {
return 'Simulator';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoadSimulator, maybe? Needs more description :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah done


switch (throttlingMethod) {
case 'provided':
options.rtt = networkAnalysis.rtt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there's the possibility we want to allow a provided user to tell us what throttling they're using, but not sure if anyone will care enough (or if our estimate will be good enough regardless)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah somewhat ambiguous how they would do that for now, let's leave it for another day :)

@@ -204,10 +204,11 @@ class Runner {
* Otherwise returns error audit result.
* @param {!Audit} audit
* @param {!Artifacts} artifacts
* @param {*} opts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which opts is this? Is there an existing type?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, some bastard child of options.settings.opts. Maybe just {settings: LH.ConfigSettings} then? (for future type-adders :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you got it boss 👍

@@ -182,7 +182,7 @@ class Runner {
let promise = Promise.resolve();
for (const auditDefn of opts.config.audits) {
promise = promise.then(_ => {
return Runner._runAudit(auditDefn, artifacts).then(ret => auditResults.push(ret));
return Runner._runAudit(auditDefn, artifacts, opts).then(ret => auditResults.push(ret));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: conversation on settings === artifact settings, not sure of the best place, but rather than buried in the specific audits that use them (since all audits have access to settings) could be a few lines above here after artifacts is defined?

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@brendankenny brendankenny merged commit 8dad8af into master Apr 5, 2018
@brendankenny brendankenny deleted the cleanup_simulator_creation branch April 9, 2018 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants