Skip to content

Commit e417bea

Browse files
authored
Move time constants to time module (#1368)
1 parent 6b4be93 commit e417bea

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

extensions/ql-vscode/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DisposableObject } from './pure/disposable-object';
22
import { workspace, Event, EventEmitter, ConfigurationChangeEvent, ConfigurationTarget } from 'vscode';
33
import { DistributionManager } from './distribution';
44
import { logger } from './logging';
5-
import { ONE_DAY_IN_MS } from './pure/helpers-pure';
5+
import { ONE_DAY_IN_MS } from './pure/time';
66

77
/** Helper class to look up a labelled (and possibly nested) setting. */
88
export class Setting {

extensions/ql-vscode/src/pure/helpers-pure.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ export const asyncFilter = async function <T>(arr: T[], predicate: (arg0: T) =>
3131
return arr.filter((_, index) => results[index]);
3232
};
3333

34-
export const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000;
35-
export const ONE_HOUR_IN_MS = 1000 * 60 * 60;
36-
export const TWO_HOURS_IN_MS = 1000 * 60 * 60 * 2;
37-
export const THREE_HOURS_IN_MS = 1000 * 60 * 60 * 3;
38-
3934
/**
4035
* This regex matches strings of the form `owner/repo` where:
4136
* - `owner` is made up of alphanumeric characters or single hyphens, starting and ending in an alphanumeric character

extensions/ql-vscode/src/pure/time.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
/*
2-
* Contains an assortment of helper functions for working with time, dates, and durations.
2+
* Contains an assortment of helper constants and functions for working with time, dates, and durations.
33
*/
44

5+
export const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000;
6+
export const ONE_HOUR_IN_MS = 1000 * 60 * 60;
7+
export const TWO_HOURS_IN_MS = 1000 * 60 * 60 * 2;
8+
export const THREE_HOURS_IN_MS = 1000 * 60 * 60 * 3;
59

610
const durationFormatter = new Intl.RelativeTimeFormat('en', {
711
numeric: 'auto',

extensions/ql-vscode/src/query-history.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ import { URLSearchParams } from 'url';
2828
import { QueryServerClient } from './queryserver-client';
2929
import { DisposableObject } from './pure/disposable-object';
3030
import { commandRunner } from './commandRunner';
31-
import { assertNever, ONE_HOUR_IN_MS, TWO_HOURS_IN_MS, getErrorMessage, getErrorStack } from './pure/helpers-pure';
31+
import { ONE_HOUR_IN_MS, TWO_HOURS_IN_MS } from './pure/time';
32+
import { assertNever, getErrorMessage, getErrorStack } from './pure/helpers-pure';
3233
import { CompletedLocalQueryInfo, LocalQueryInfo as LocalQueryInfo, QueryHistoryInfo } from './query-results';
3334
import { DatabaseManager } from './databases';
3435
import { registerQueryHistoryScubber } from './query-history-scrubber';
@@ -854,15 +855,15 @@ export class QueryHistoryManager extends DisposableObject {
854855

855856
if (finalSingleItem.evalLogSummaryLocation) {
856857
await this.tryOpenExternalFile(finalSingleItem.evalLogSummaryLocation);
857-
}
858+
}
858859
// Summary log file doesn't exist.
859860
else {
860861
if (finalSingleItem.evalLogLocation && fs.pathExists(finalSingleItem.evalLogLocation)) {
861862
// If raw log does exist, then the summary log is still being generated.
862863
this.warnInProgressEvalLogSummary();
863864
} else {
864865
this.warnNoEvalLogSummary();
865-
}
866+
}
866867
}
867868
}
868869

extensions/ql-vscode/src/vscode-tests/no-workspace/query-history.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { QueryServerClient } from '../../queryserver-client';
1414
import { LocalQueryInfo, InitialQueryInfo } from '../../query-results';
1515
import { DatabaseManager } from '../../databases';
1616
import * as tmp from 'tmp-promise';
17-
import { ONE_DAY_IN_MS, ONE_HOUR_IN_MS, TWO_HOURS_IN_MS, THREE_HOURS_IN_MS } from '../../pure/helpers-pure';
17+
import { ONE_DAY_IN_MS, ONE_HOUR_IN_MS, TWO_HOURS_IN_MS, THREE_HOURS_IN_MS } from '../../pure/time';
1818
import { tmpDir } from '../../helpers';
1919
import { getErrorMessage } from '../../pure/helpers-pure';
2020
import { HistoryItemLabelProvider } from '../../history-item-label-provider';

0 commit comments

Comments
 (0)