Skip to content

WAT-454 http throttling#40

Merged
johnthecat merged 7 commits intoringcentral:masterfrom
terrainvidia:WAT-454-http-throttling
Oct 23, 2018
Merged

WAT-454 http throttling#40
johnthecat merged 7 commits intoringcentral:masterfrom
terrainvidia:WAT-454-http-throttling

Conversation

@terrainvidia
Copy link
Contributor

No description provided.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 683

  • 22 of 25 (88.0%) changed or added relevant lines in 4 files are covered.
  • 34 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.5%) to 79.713%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/http-api/src/abstract-http-client.ts 20 21 95.24%
packages/api/src/run.ts 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
packages/cli-config/src/arguments-parser.ts 1 55.74%
packages/fs-reader/src/file-locator.ts 1 38.46%
packages/child-process/src/resolve-binary.ts 3 57.14%
packages/cli-config/src/config-file-reader.ts 3 46.55%
packages/element-path/src/proxify.ts 4 85.07%
packages/child-process/src/fork.ts 6 62.07%
packages/logger/src/format-log.ts 16 20.55%
Totals Coverage Status
Change from base Build 677: 0.5%
Covered Lines: 1564
Relevant Lines: 1919

💛 - Coveralls

@coveralls
Copy link

coveralls commented Oct 17, 2018

Pull Request Test Coverage Report for Build 689

  • 23 of 24 (95.83%) changed or added relevant lines in 3 files are covered.
  • 49 unchanged lines in 14 files lost coverage.
  • Overall coverage increased (+1.9%) to 80.834%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/http-api/src/abstract-http-client.ts 21 22 95.45%
Files with Coverage Reduction New Missed Lines %
packages/cli-config/src/arguments-parser.ts 1 96.3%
packages/transport/src/serialize/object.ts 1 84.21%
packages/utils/src/plugin-require.ts 1 88.0%
packages/fs-reader/src/file-locator.ts 1 84.62%
packages/utils/src/find-available-ports.ts 1 95.0%
packages/transport/src/serialize/function.ts 1 87.8%
packages/transport/src/serialize/date.ts 2 60.0%
packages/transport/src/serialize/buffer.ts 2 60.0%
packages/cli-config/src/config-file-reader.ts 3 94.23%
packages/web-application/src/utils.ts 4 10.0%
Totals Coverage Status
Change from base Build 684: 1.9%
Covered Lines: 1651
Relevant Lines: 1990

💛 - Coveralls

private queueRunning = false;

constructor(protected transportInstance: ITransport) {
constructor(protected transportInstance: ITransport, private httpThrottle: number) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe better use options object, with httpThrottle property to solve problem possible additional properties in feature.

queuedTest.parameters,
this.config.envParameters
this.config.envParameters,
this.config.httpThrottle
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have runData property in this.config.parameters. Not sure it's a good idea to make new argument for every config parameter that we will need.


let isAsync = false;

this.testAPI.setHttpThrottle(message.httpThrottle);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer as with execute send this property with test parameters

@flops flops changed the title http throttling WAT-454 http throttling Oct 17, 2018
@terrainvidia
Copy link
Contributor Author

terrainvidia commented Oct 18, 2018

@flops Moved httpThrottle to parameters in worker. abstractHttpClient is now using params object.
Please review again.

httpThrottle: config.httpThrottle,
};

this.http = new HttpClient(transport, httpClientParams);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
this.http = new HttpClient(transport, httpClientParams);
this.httpClient = new HttpClient(transport, {
httpThrottle: config.httpThrottle,
});

const httpClientParams = {
httpThrottle: this.config.httpThrottle,
};
const httpClient = new HttpClientLocal(this.transport, httpClientParams);
Copy link
Contributor

Choose a reason for hiding this comment

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

As above

const httpClientParams = {
httpThrottle: this.config.httpThrottle,
};
const httpClient = new HttpClientLocal(this.transport, httpClientParams);
Copy link
Contributor

Choose a reason for hiding this comment

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

As above


constructor(protected transportInstance: ITransport) {
constructor(protected transportInstance: ITransport, private params: HttpClientParams) {
this.queue = new Queue();
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't use common words for naming

Suggested change
this.queue = new Queue();
this.requestQueue = new Queue();

this.queueRunning = false;
}

private pushQueue(requestParameters: IHttpRequest, cookieJar?: IHttpCookieJar): Promise<any> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private pushQueue(requestParameters: IHttpRequest, cookieJar?: IHttpCookieJar): Promise<any> {
private pushToQueue(requestParameters: IHttpRequest, cookieJar?: IHttpCookieJar): Promise<any> {


private pushQueue(requestParameters: IHttpRequest, cookieJar?: IHttpCookieJar): Promise<any> {
return new Promise(async (resolve, reject) => {
this.queue.push(() => this.sendRequest(requestParameters, cookieJar).then(resolve, reject));
Copy link
Contributor

Choose a reason for hiding this comment

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

Move function to separated variable

let screenshotsEnabled = false;
let isRetryRun = queueItem.retryCount > 0;
const {
debug = false,
Copy link
Contributor

Choose a reason for hiding this comment

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

don't use default values, they must be already defined in config

@johnthecat johnthecat merged commit ba40901 into ringcentral:master Oct 23, 2018
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