Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
feat: use small HTTP dependency (#510)
Browse files Browse the repository at this point in the history
Improve load time from 1000 ms to under 800 ms.

Drive-by fix: Delete unused import.
  • Loading branch information
fhinkel authored and JustinBeckwith committed Aug 30, 2018
1 parent 9512bac commit ce903bc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -57,6 +57,7 @@
"once": "^1.4.0",
"post-install-check": "0.0.1",
"proxyquire": "^2.0.0",
"request": "^2.88.0",
"require-inject": "^1.4.3",
"rimraf": "^2.6.2",
"source-map-support": "^0.5.6",
Expand All @@ -74,10 +75,10 @@
"gcp-metadata": "^0.7.0",
"lodash": "^4.12.0",
"p-limit": "^2.0.0",
"request": "^2.81.0",
"semver": "^5.5.0",
"source-map": "^0.6.1",
"split": "^1.0.0",
"teeny-request": "^3.6.0",
"util.promisify": "^1.0.0"
},
"scripts": {
Expand Down
10 changes: 8 additions & 2 deletions src/agent/controller.ts
Expand Up @@ -21,7 +21,9 @@
import {ServiceObject} from '@google-cloud/common';
import * as assert from 'assert';
import * as qs from 'querystring';
import * as request from 'request';
import * as request from 'request'; // Only for type declarations.
import {teenyRequest} from 'teeny-request';

import {URL} from 'url';

import {Debug} from '../client/stackdriver/debug';
Expand All @@ -41,7 +43,11 @@ export class Controller extends ServiceObject {
*/

constructor(debug: Debug, config?: {apiUrl?: string}) {
super({requestModule: request, parent: debug, baseUrl: '/controller'});
super({
requestModule: teenyRequest as typeof request,
parent: debug,
baseUrl: '/controller'
});

/** @private {string} */
this.nextWaitToken = null;
Expand Down
1 change: 0 additions & 1 deletion src/agent/debuglet.ts
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import {GoogleAuthOptions} from '@google-cloud/common';
import * as assert from 'assert';
import * as consoleLogLevel from 'console-log-level';
import * as crypto from 'crypto';
Expand Down
5 changes: 3 additions & 2 deletions src/client/stackdriver/debug.ts
Expand Up @@ -15,7 +15,8 @@
*/

import {GoogleAuthOptions, Service} from '@google-cloud/common';
import * as request from 'request';
import * as request from 'request'; // Only for type declarations.
import {teenyRequest} from 'teeny-request';

export interface PackageInfo {
name: string;
Expand Down Expand Up @@ -57,7 +58,7 @@ export class Debug extends Service {
}

const config = {
requestModule: request,
requestModule: teenyRequest as typeof request,
projectIdRequired: false,
baseUrl: 'https://clouddebugger.googleapis.com/v2',
scopes: ['https://www.googleapis.com/auth/cloud_debugger'],
Expand Down

0 comments on commit ce903bc

Please sign in to comment.