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

Enhance ActiveWorkspaceCommand to order, limit and startFrom workspaceId #10378

Merged
merged 3 commits into from
Feb 21, 2025

Conversation

charlesBochet
Copy link
Member

I have tested it locally with all combinaisons of params

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 enhances the ActiveWorkspaceCommand with pagination and ordering capabilities, while improving error handling for workspace migrations.

  • Added startFromWorkspaceId option in active-workspaces.command.ts to process workspaces starting from a specific ID
  • Added workspaceCountLimit option in active-workspaces.command.ts to limit the number of processed workspaces
  • Changed workspace ordering to use id instead of createdAt in active-workspaces.command.ts for consistent pagination
  • Improved error resilience in 0-42-migrate-rich-text-field.command.ts by handling failures per workspace instead of stopping entire migration
  • Ensured proper cleanup of data sources by moving destroyDataSourceForWorkspace outside try-catch block

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

'Limit the number of workspaces to process. Workspaces are processed in ascending order of id.',
required: false,
})
parseWorkspaceCountLimit(val: number): number {
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: val parameter should be typed as string since CLI inputs are strings by default. Need to convert to number internally.

Suggested change
parseWorkspaceCountLimit(val: number): number {
parseWorkspaceCountLimit(val: string): number {

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! Could miss a few workspaces if new ones are created after but those probably won't need any command anyway!

Copy link
Contributor

@prastoin prastoin left a comment

Choose a reason for hiding this comment

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

That's a very good improvement

'Start from a specific workspace id. Workspaces are processed in ascending order of id.',
required: false,
})
parseStartFromWorkspaceId(val: string): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

NItpick: Unless I'm mistaken should be optional

required: false,
})
parseWorkspaceCountLimit(val: number): number {
this.workspaceCountLimit = val;
Copy link
Contributor

@prastoin prastoin Feb 21, 2025

Choose a reason for hiding this comment

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

Nitpick: Unless I'm mistaken should validate is > 0 and should be optional

@prastoin
Copy link
Contributor

prastoin commented Feb 21, 2025

Member

Unless I'm mistaken this might not be an issue as if a new workspace is created it should already be migrated by definition

@charlesBochet charlesBochet merged commit 311fc40 into main Feb 21, 2025
30 checks passed
@charlesBochet charlesBochet deleted the enhance-active-workspaces-command branch February 21, 2025 09:37
prastoin pushed a commit that referenced this pull request Feb 21, 2025
…eId (#10378)

I have tested it locally with all combinaisons of params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants