Skip to content

Commit

Permalink
fix(deps): update dependency parse-duration to 0.4.4 (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Jul 16, 2020
1 parent 2712030 commit 2757231
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"delay": "^4.0.1",
"extend": "^3.0.2",
"gcp-metadata": "^4.0.0",
"parse-duration": "^0.1.1",
"parse-duration": "^0.4.4",
"pprof": "2.0.0",
"pretty-ms": "^7.0.0",
"protobufjs": "~6.10.0",
Expand All @@ -48,7 +48,6 @@
"@types/mocha": "^8.0.0",
"@types/nock": "^10.0.0",
"@types/node": "^10.0.3",
"@types/parse-duration": "^0.1.0",
"@types/pretty-ms": "^4.0.0",
"@types/sinon": "^9.0.0",
"@types/tmp": "0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import {GoogleAuthOptions} from '@google-cloud/common';
import parseDuration = require('parse-duration');
import parseDuration from 'parse-duration';

// Configuration for Profiler.
export interface Config extends GoogleAuthOptions {
Expand Down
11 changes: 6 additions & 5 deletions src/profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
ServiceConfig,
ServiceObject,
ApiError,
DecorateRequestOptions,
} from '@google-cloud/common';
import {heap as heapProfiler, SourceMapper, time as timeProfiler} from 'pprof';
import * as msToStr from 'pretty-ms';
Expand All @@ -28,7 +29,7 @@ import {perftools} from '../protos/profile';
import {ProfilerConfig} from './config';
import {createLogger} from './logger';

import parseDuration = require('parse-duration');
import parseDuration from 'parse-duration';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pjson = require('../../package.json');
const SCOPE = 'https://www.googleapis.com/auth/monitoring.write';
Expand Down Expand Up @@ -110,7 +111,7 @@ function getServerResponseBackoff(body: object): number | undefined {
item.retryDelay &&
typeof item.retryDelay === 'string'
) {
const backoffMillis = parseDuration(item.retryDelay);
const backoffMillis = parseDuration(item.retryDelay)!;
if (backoffMillis > 0) {
return backoffMillis;
}
Expand All @@ -135,7 +136,7 @@ export function parseBackoffDuration(
undefined,
];
if (duration) {
const backoffMillis = parseDuration(duration);
const backoffMillis = parseDuration(duration)!;
if (backoffMillis > 0) {
return backoffMillis;
}
Expand Down Expand Up @@ -434,7 +435,7 @@ export class Profiler extends ServiceObject {
deployment: this.deployment,
profileType: this.profileTypes,
};
const options = {
const options: DecorateRequestOptions = {
method: 'POST',
uri: '/profiles',
body: reqBody,
Expand All @@ -444,7 +445,7 @@ export class Profiler extends ServiceObject {
// Default timeout for for a request is 1 minute, but request to create
// profile is designed to hang until it is time to collect a profile
// (up to one hour).
timeout: parseDuration('1h'),
timeout: parseDuration('1h')!,
};

this.logger.debug('Attempting to create profile.');
Expand Down
6 changes: 3 additions & 3 deletions test/test-profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
timeProfile,
} from './profiles-for-tests';

import parseDuration = require('parse-duration');
import parseDuration from 'parse-duration';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fakeCredentials = require('../../test/fixtures/gcloud-credentials.json');

Expand All @@ -61,9 +61,9 @@ const testConfig: ProfilerConfig = {
heapMaxStackDepth: 64,
ignoreHeapSamplesPath: '@google-cloud/profiler',
initialBackoffMillis: 1000,
backoffCapMillis: parseDuration('1h'),
backoffCapMillis: parseDuration('1h')!,
backoffMultiplier: 1.3,
serverBackoffCapMillis: parseDuration('7d'),
serverBackoffCapMillis: parseDuration('7d')!,
localProfilingPeriodMillis: 1000,
localTimeDurationMillis: 1000,
localLogPeriodMillis: 1000,
Expand Down

0 comments on commit 2757231

Please sign in to comment.