Skip to content

Commit 4f27800

Browse files
committed
[server] Enable connection limiting for free tier
1 parent d9f460b commit 4f27800

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

components/gitpod-protocol/src/protocol.ts

+1
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ export const WorkspaceFeatureFlags = {
295295
persistent_volume_claim: undefined,
296296
protected_secrets: undefined,
297297
workspace_class_limiting: undefined,
298+
workspace_connection_limiting: undefined,
298299
};
299300
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
300301

components/server/src/workspace/workspace-starter.ts

+17-2
Original file line numberDiff line numberDiff line change
@@ -859,10 +859,25 @@ export class WorkspaceStarter {
859859
}
860860
}
861861

862-
let workspaceClass = "";
863862
const userTeams = await this.teamDB.findTeamsByUser(user.id);
863+
const wsConnectionLimitingEnabled = await getExperimentsClientForBackend().getValueAsync(
864+
"workspace_connection_limiting",
865+
false,
866+
{ user, teams: userTeams },
867+
);
868+
if (wsConnectionLimitingEnabled) {
869+
const shouldLimitNetworkConnections = await this.entitlementService.limitNetworkConnections(
870+
user,
871+
new Date(),
872+
);
873+
if (shouldLimitNetworkConnections) {
874+
featureFlags = featureFlags.concat(["workspace_connection_limiting"]);
875+
}
876+
}
877+
878+
let workspaceClass = "";
864879
let classesEnabled = await getExperimentsClientForBackend().getValueAsync("workspace_classes", false, {
865-
user: user,
880+
user,
866881
teams: userTeams,
867882
});
868883
const usageAttributionId = await this.userService.getWorkspaceUsageAttributionId(user, workspace.projectId);

0 commit comments

Comments
 (0)