Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
geropl committed Nov 14, 2023
1 parent f7f4693 commit 990cf8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
20 changes: 4 additions & 16 deletions components/server/src/api/organization-service-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
return response;
}

async updateOrganization(
req: UpdateOrganizationRequest,
_: HandlerContext,
): Promise<UpdateOrganizationResponse> {
async updateOrganization(req: UpdateOrganizationRequest, _: HandlerContext): Promise<UpdateOrganizationResponse> {
if (!uuidValidate(req.organizationId)) {
throw new ConnectError("organizationId is required", Code.InvalidArgument);
}
Expand All @@ -95,10 +92,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
});
}

async listOrganizations(
req: ListOrganizationsRequest,
_: HandlerContext,
): Promise<ListOrganizationsResponse> {
async listOrganizations(req: ListOrganizationsRequest, _: HandlerContext): Promise<ListOrganizationsResponse> {
const orgs = await this.orgService.listOrganizations(
ctxUserId(),
{
Expand All @@ -114,10 +108,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
return response;
}

async deleteOrganization(
req: DeleteOrganizationRequest,
_: HandlerContext,
): Promise<DeleteOrganizationResponse> {
async deleteOrganization(req: DeleteOrganizationRequest, _: HandlerContext): Promise<DeleteOrganizationResponse> {
if (!uuidValidate(req.organizationId)) {
throw new ConnectError("organizationId is required", Code.InvalidArgument);
}
Expand Down Expand Up @@ -259,10 +250,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
throw new ConnectError("nothing to update", Code.InvalidArgument);
}

const settings = await this.orgService.updateSettings(ctxUserId(), req.organizationId, {
workspaceSharingDisabled: req.workspaceSharingDisabled,
defaultWorkspaceImage: req.defaultWorkspaceImage,
});
const settings = await this.orgService.updateSettings(ctxUserId(), req.organizationId, update);
return new UpdateOrganizationSettingsResponse({
settings: this.apiConverter.toOrganizationSettings(settings),
});
Expand Down
1 change: 0 additions & 1 deletion components/server/src/prebuilds/github-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export class GithubApp {
},
() => next(),
);
next();
});

app.on("installation.created", (ctx: Context<"installation.created">) => {
Expand Down
11 changes: 7 additions & 4 deletions components/server/src/websocket/websocket-connection-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
import { EventEmitter } from "events";
import express from "express";
import { ErrorCodes as RPCErrorCodes, MessageConnection, ResponseError } from "vscode-jsonrpc";
import { ErrorCodes as RPCErrorCodes, MessageConnection, ResponseError, CancellationToken } from "vscode-jsonrpc";
import { AllAccessFunctionGuard, FunctionAccessGuard, WithFunctionAccessGuard } from "../auth/function-access";
import { HostContextProvider } from "../auth/host-context-provider";
import { isValidFunctionName, RateLimiter, RateLimiterConfig, UserRateLimiter } from "../auth/rate-limiter";
Expand Down Expand Up @@ -377,13 +377,16 @@ class GitpodJsonRpcProxyFactory<T extends object> extends JsonRpcProxyFactory<T>
protected async onRequest(method: string, ...args: any[]): Promise<any> {
const span = TraceContext.startSpan(method, undefined);
const userId = this.clientMetadata.userId;
const rpcSignal = args[args.length - 1];
const signal = rpcSignal ? (rpcSignal as AbortSignal) : new AbortController().signal;
const abortController = new AbortController();
const cancellationToken = args[args.length - 1];
if (CancellationToken.is(cancellationToken)) {
cancellationToken.onCancellationRequested(() => abortController.abort());
}
return runWithRequestContext(
{
requestKind: "jsonrpc",
requestMethod: method,
signal,
signal: abortController.signal,
subjectId: userId ? SubjectId.fromUserId(userId) : undefined,
traceId: span.context().toTraceId(),
},
Expand Down

0 comments on commit 990cf8c

Please sign in to comment.