Skip to content

Commit 2706e33

Browse files
committed
💄
1 parent 2dd6068 commit 2706e33

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: |
2424
set -e
2525
setSegmentKey="setpath([\"segmentKey\"]; \"untrusted-dummy-key\")"
26-
setConfigcatKey="setpath([\"configcatKey\"]; \"${{ secrets.CONFIGCAT_KEY }}\")"
26+
setConfigcatKey="setpath([\"configcatKey\"]; \"gitpod\")"
2727
jqCommands="${setSegmentKey} | ${setConfigcatKey}"
2828
cat package.json | jq "${jqCommands}" > package.json.tmp
2929
mv package.json.tmp package.json

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
run: |
2121
set -e
2222
setSegmentKey="setpath([\"segmentKey\"]; \"untrusted-dummy-key\")"
23-
setConfigcatKey="setpath([\"configcatKey\"]; \"${{ secrets.CONFIGCAT_KEY }}\")"
23+
setConfigcatKey="setpath([\"configcatKey\"]; \"gitpod\")"
2424
jqCommands="${setSegmentKey} | ${setConfigcatKey}"
2525
cat package.json | jq "${jqCommands}" > package.json.tmp
2626
mv package.json.tmp package.json

src/experiments.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,27 @@ import * as semver from 'semver';
1010
import { ISessionService } from './services/sessionService';
1111
import { ILogService } from './services/logService';
1212
import { IHostService } from './services/hostService';
13+
import { Disposable } from './common/dispose';
1314

1415
const EXPERIMENTAL_SETTINGS = [
1516
'gitpod.remote.useLocalApp',
1617
// 'gitpod.remote.useLocalSSHServer',
1718
];
1819

19-
export class ExperimentalSettings {
20+
export class ExperimentalSettings extends Disposable {
2021
private configcatClient: configcatcommon.IConfigCatClient;
2122
private extensionVersion: semver.SemVer;
2223

2324
constructor(
2425
key: string,
2526
extensionVersion: string,
27+
context: vscode.ExtensionContext,
2628
private readonly sessionService: ISessionService,
2729
private readonly hostService: IHostService,
2830
private readonly logger: ILogService
2931
) {
32+
super();
33+
3034
const configCatOptions = {
3135
logger: {
3236
debug(): void { },
@@ -39,17 +43,20 @@ export class ExperimentalSettings {
3943
cacheTimeToLiveSeconds: 60
4044
};
4145

46+
const gitpodHost = context.extensionMode === vscode.ExtensionMode.Production ? this.hostService.gitpodHost : 'https://gitpod-staging.com';
4247
this.configcatClient = configcat.createClientWithLazyLoad(key, {
43-
baseUrl: new URL('/configcat', this.hostService.gitpodHost).href,
48+
baseUrl: new URL('/configcat', gitpodHost).href,
4449
...configCatOptions
4550
});
4651

47-
hostService.onDidChangeHost(() => {
52+
this._register(hostService.onDidChangeHost(() => {
53+
this.configcatClient.dispose();
54+
const gitpodHost = context.extensionMode === vscode.ExtensionMode.Production ? this.hostService.gitpodHost : 'https://gitpod-staging.com';
4855
this.configcatClient = configcat.createClientWithLazyLoad(key, {
49-
baseUrl: new URL('/configcat', this.hostService.gitpodHost).href,
56+
baseUrl: new URL('/configcat', gitpodHost).href,
5057
...configCatOptions
5158
});
52-
});
59+
}));
5360

5461
this.extensionVersion = new semver.SemVer(extensionVersion);
5562
}
@@ -125,7 +132,8 @@ export class ExperimentalSettings {
125132
return this.extensionVersion.minor % 2 === 1;
126133
}
127134

128-
dispose(): void {
135+
override dispose(): void {
136+
super.dispose();
129137
this.configcatClient.dispose();
130138
}
131139

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export async function activate(context: vscode.ExtensionContext) {
7878
const sessionService = new SessionService(hostService, logger);
7979
context.subscriptions.push(sessionService);
8080

81-
const experiments = new ExperimentalSettings('gitpod', packageJSON.version, sessionService, hostService,logger);
81+
const experiments = new ExperimentalSettings(packageJSON.configcatKey, packageJSON.version, context, sessionService, hostService, logger);
8282
context.subscriptions.push(experiments);
8383

8484
const settingsSync = new SettingsSync(commandManager, logger, telemetryService, notificationService);

src/services/hostService.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ export class HostService extends Disposable implements IHostService {
4444

4545
this._register(vscode.workspace.onDidChangeConfiguration(e => {
4646
if (e.affectsConfiguration('gitpod.host')) {
47+
if (e.affectsConfiguration('[javascript]') && e.affectsConfiguration('[markdown]')) {
48+
// Seems onDidChangeConfiguration fires many times while resolving the remote (once with all settings),
49+
// and because now we active the extension earlier with onResolveRemoteAuthority we get this false positive
50+
// event, so ignore it if more settings are affected at the same time.
51+
return;
52+
}
4753
const newGitpodHost = Configuration.getGitpodHost();
4854
if (new URL(this._gitpodHost).host !== new URL(newGitpodHost).host) {
4955
this._gitpodHost = newGitpodHost;

0 commit comments

Comments
 (0)