Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error messages on sign up #10399

Merged
merged 5 commits into from
Feb 21, 2025
Merged

Fix error messages on sign up #10399

merged 5 commits into from
Feb 21, 2025

Conversation

charlesBochet
Copy link
Member

@charlesBochet charlesBochet commented Feb 21, 2025

In this PR:

  • adding logs to track workspace creation performance
  • refactor useIsWorkspaceSuspended to be more generic
  • only fetch favorites and views if workspace is Active to avoid error messages on sign up (workspace is not created yet)

@@ -63,11 +63,19 @@ export class WorkspaceManagerService {
workspaceId: string;
userId: string;
}): Promise<void> {
const schemaCreationStart = performance.now();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporarily adding these logs to troubleshoot prod performance on workspace creation (~15s in prod) and see what optimizations we can do while keeping 2k5 workspaces on prod

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a decorator for that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah never mind, you don't want log for the whole function

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR refactors workspace activation status checks across the frontend codebase, introducing performance monitoring on the backend. Here's a concise summary of the key changes:

  • Introduced new useIsWorkspaceActivationStatusEqualsTo hook in /packages/twenty-front/src/modules/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo.ts for flexible workspace status checks
  • Replaced useIsWorkspaceActivationStatusSuspended with the new hook across multiple components for more consistent status checking
  • Added performance logging in /packages/twenty-server/src/engine/workspace-manager/workspace-manager.service.ts to measure workspace initialization steps
  • Added detailed timing metrics in /packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/workspace-sync-metadata.service.ts for metadata sync operations
  • Changed workspace status checks from negative (suspended) to positive (active) conditions in prefetch components for better readability

The changes improve code maintainability while adding valuable performance insights for debugging and monitoring.

11 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

`Metadata creation took ${dataSourceMetadataCreationEnd - dataSourceMetadataCreationStart}ms`,
);

const permissionsEnabledStart = performance.now();
const permissionsEnabled =
await this.permissionsService.isPermissionsEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Explicit boolean comparison with === true is redundant

Suggested change
await this.permissionsService.isPermissionsEnabled();
if (permissionsEnabled) {

Comment on lines +95 to +97
this.logger.log(
`Workspace object migrations took ${workspaceObjectMigrationsEnd - workspaceObjectMigrationsStart}ms`,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: use this.logger.log() instead of console.log() for consistent logging and production environments

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@charlesBochet charlesBochet merged commit 2039986 into main Feb 21, 2025
8 checks passed
@charlesBochet charlesBochet deleted the fix-bug-critical branch February 21, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants