Skip to content

Commit 0d82725

Browse files
geroplroboquat
authored andcommitted
[server] Minor performance improvement to generic auth provider
1 parent 89b9f34 commit 0d82725

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

components/server/src/auth/generic-auth-provider.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,13 @@ export class GenericAuthProvider implements AuthProvider {
238238
}
239239
}
240240

241+
protected cachedAuthCallbackPath: string | undefined = undefined;
241242
get authCallbackPath() {
242-
return new URL(this.oauthConfig.callBackUrl).pathname;
243+
// This ends up being called quite often so we cache the URL constructor
244+
if (this.cachedAuthCallbackPath === undefined) {
245+
this.cachedAuthCallbackPath = new URL(this.oauthConfig.callBackUrl).pathname;
246+
}
247+
return this.cachedAuthCallbackPath;
243248
}
244249

245250

0 commit comments

Comments
 (0)