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

feat: Improve Performance of delete Command with Concurrency #80

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bupd
Copy link
Contributor

@bupd bupd commented May 27, 2024

Fixes: #79

Description:

This PR enhances the performance of the harbor project delete command by introducing concurrency to handle multiple project deletions in parallel. The changes ensure that the command is more efficient, especially when dealing with multiple projects.

Changes:

  • Concurrency Implementation:
  • Added goroutines to execute runDeleteProject concurrently for each project specified in the command arguments.

Error Handling:

  • Implemented an error channel (errChan) to collect errors from each goroutine.
  • Ensured all errors are logged appropriately after all goroutines have completed.

Benefits:

  • Performance: By running deletions concurrently, the command execution time is significantly reduced when dealing with multiple projects.
  • Reliability: Enhanced error handling ensures that all errors are captured and logged, providing better visibility into potential issues.

Testing:

  • Tested the command without args and with multiple project names to ensure concurrent deletions work as expected.

Example Usage:

# Delete multiple projects concurrently
harbor project delete project1 project2 project3

# Delete a single project by prompting the user
harbor project delete

@bupd bupd changed the title add: Improve Performance of Project Deletion Command with Concurrency feat: Improve Performance of Project Deletion Command with Concurrency May 27, 2024
@bupd bupd changed the title feat: Improve Performance of Project Deletion Command with Concurrency feat: Improve Performance of project delete Command with Concurrency May 27, 2024
@bupd bupd force-pushed the batch-process branch from 72e21a6 to 6a4c6a7 Compare May 27, 2024 04:00
@bupd bupd changed the title feat: Improve Performance of project delete Command with Concurrency feat: Improve Performance of delete Command with Concurrency May 28, 2024
@bupd
Copy link
Contributor Author

bupd commented May 28, 2024

Before:

  • The delete commands not have multiple deletion at a time.

BeforeMultipleDeletion

After:

  • The delete commands deletes multiple resources at a time.

DeleteMultiple

@bupd bupd force-pushed the batch-process branch from 16b8d6e to 21ba50a Compare May 29, 2024 14:46
Copy link
Contributor

@amands98 amands98 left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! Could you add multiple selection in the TUI too? And can you combine the commits into one for a cleaner history?

@bupd
Copy link
Contributor Author

bupd commented May 29, 2024

Could you add multiple selection in the TUI.

Currently working on TUI multiple selection.

Will squash the commits.

@bupd bupd force-pushed the batch-process branch from 21ba50a to 629ff2c Compare May 29, 2024 18:03
@bupd
Copy link
Contributor Author

bupd commented May 30, 2024

I am planning to add the multiple TUI selection as a base component in separate PR.
which can be used by multiple commands that support multiple selection and their associated action
with that we can mimic the behavior of multiple select and action in TUI.

@bupd bupd requested a review from amands98 May 30, 2024 23:05
@bupd
Copy link
Contributor Author

bupd commented May 30, 2024

This PR is ready for review @Vad1mo

@bupd
Copy link
Contributor Author

bupd commented Sep 21, 2024

ready to merge.

@bupd bupd added the enhancement New feature or request label Oct 20, 2024
Copy link
Contributor Author

@bupd bupd left a comment

Choose a reason for hiding this comment

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

should rebase with new changes

handles concurrent deletion of projects, registries and users

Signed-off-by: bupd <[email protected]>
Copy link
Contributor Author

@bupd bupd left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for Deleting Multiple Projects in CLI
2 participants