From 97f3cd456d0fd52aeae7e9c429d8b4c8ab75b9aa Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 9 May 2024 13:26:53 +0200 Subject: [PATCH] profiling --- backend/src/apis/humhub/HumHubClient.ts | 3 +++ backend/src/apis/humhub/syncUser.ts | 3 +-- backend/src/graphql/resolver/UserResolver.ts | 3 +++ frontend/src/pages/Settings.vue | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/src/apis/humhub/HumHubClient.ts b/backend/src/apis/humhub/HumHubClient.ts index 6fe04e719..975dacaa8 100644 --- a/backend/src/apis/humhub/HumHubClient.ts +++ b/backend/src/apis/humhub/HumHubClient.ts @@ -105,7 +105,10 @@ export class HumHubClient { } public async userByEmailAsync(email: string): Promise> { + const startTime = new Date() const options = await this.createRequestOptions({ email }) + const endTime = new Date() + console.log("time for prepare connection: ", endTime.getTime() - startTime.getTime()) return this.restClient.get('/api/v1/user/get-by-email', options) } diff --git a/backend/src/apis/humhub/syncUser.ts b/backend/src/apis/humhub/syncUser.ts index b2957c555..fc6fcc99b 100644 --- a/backend/src/apis/humhub/syncUser.ts +++ b/backend/src/apis/humhub/syncUser.ts @@ -39,8 +39,7 @@ export async function syncUser( if (humhubUser) { if (!user.humhubAllowed) { - postUser.account.status = 0 - await humHubClient.updateUser(postUser, humhubUser.id) + await humHubClient.deleteUser(humhubUser.id) return ExecutedHumhubAction.DELETE } if (!isHumhubUserIdenticalToDbUser(humhubUser, user)) { diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 9f6ce8d74..095b26062 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -200,7 +200,10 @@ export class UserResolver { await EVENT_USER_LOGIN(dbUser) // load humhub state if (CONFIG.HUMHUB_ACTIVE && user.humhubAllowed) { + const startTime = new Date() const result = await humhubUserPromise + const endTime = new Date() + console.log("wait for humhub at login ", endTime.getTime() - startTime.getTime()) user.humhubAllowed = result?.result?.account.status === 1 } logger.info(`successful Login: ${JSON.stringify(user, null, 2)}`) diff --git a/frontend/src/pages/Settings.vue b/frontend/src/pages/Settings.vue index dc7da13d4..d517feb20 100644 --- a/frontend/src/pages/Settings.vue +++ b/frontend/src/pages/Settings.vue @@ -241,7 +241,7 @@ export default { return firstName === this.firstName && lastName === this.lastName }, isHumhubActivated() { - return false // this.humhubAllowed + return this.humhubAllowed }, isCommunityService() { return this.isGMS || this.isHumhub