Skip to content

Commit 12d929a

Browse files
akosyakovjeanp413
authored andcommitted
[desktop] use Date.now instead of performance.now
1 parent 8f216f7 commit 12d929a

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

extensions/gitpod-remote/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "%displayName%",
44
"description": "%description%",
55
"publisher": "gitpod",
6-
"version": "0.0.21",
6+
"version": "0.0.22",
77
"license": "MIT",
88
"preview": true,
99
"icon": "resources/gitpod.png",

extensions/gitpod/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "%displayName%",
44
"description": "%description%",
55
"publisher": "gitpod",
6-
"version": "0.0.21",
6+
"version": "0.0.22",
77
"license": "MIT",
88
"preview": true,
99
"icon": "resources/gitpod.png",

extensions/gitpod/src/extension.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import * as fs from 'fs';
1212
import * as http from 'http';
1313
import * as net from 'net';
1414
import fetch, { Response } from 'node-fetch';
15-
import { performance } from 'perf_hooks';
1615
import * as tmp from 'tmp';
1716
import * as path from 'path';
1817
import * as vscode from 'vscode';
@@ -64,7 +63,7 @@ export async function activate(context: vscode.ExtensionContext) {
6463
for (const key of context.globalState.keys()) {
6564
if (key.startsWith(lockPrefix)) {
6665
const lock = context.globalState.get<Lock>(key);
67-
if (typeof lock !== 'object' || performance.now() >= lock.deadline) {
66+
if (typeof lock !== 'object' || Date.now() >= lock.deadline) {
6867
const lockName = key.substr(lockPrefix.length);
6968
log(`cancel stale lock: ${lockName}`);
7069
context.globalState.update(key, undefined);
@@ -83,7 +82,7 @@ export async function activate(context: vscode.ExtensionContext) {
8382
while (currentLock?.value !== value) {
8483
currentLock = context.globalState.get<Lock>(lockKey);
8584
if (!currentLock) {
86-
deadline = performance.now() + timeout + updateTimeout * 2;
85+
deadline = Date.now() + timeout + updateTimeout * 2;
8786
await context.globalState.update(lockKey, <Lock>{ value, deadline });
8887
}
8988
// TODO(ak) env.globaState.onDidChange instead, see https://github.com/microsoft/vscode/issues/131182

0 commit comments

Comments
 (0)