-
Notifications
You must be signed in to change notification settings - Fork 84
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: sync block #700
fix: sync block #700
Conversation
WalkthroughThe recent changes introduce new event types Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- app/core/event/SyncESPackage.ts (3 hunks)
- app/core/service/PackageSearchService.ts (3 hunks)
- test/repository/SearchRepository.test.ts (2 hunks)
Additional comments not posted (7)
app/core/event/SyncESPackage.ts (3)
15-16
: Added new event types for package blocking and unblocking.These new constants
PACKAGE_BLOCKED
andPACKAGE_UNBLOCKED
are well-defined and align with the PR's goal to handle blocked and unblocked packages.
35-35
: Ensure proper event registration forPACKAGE_BLOCKED
.The
@Event(PACKAGE_BLOCKED)
decorator correctly associates thePackageUnpublished
class with the blocked package event. This is crucial for the functionality described in the PR.
44-51
: Updated event handling inPackageVersionAdded
.The class now handles multiple events including
PACKAGE_META_CHANGED
andPACKAGE_UNBLOCKED
, which is consistent with the PR's description of enhancing event handling logic.test/repository/SearchRepository.test.ts (2)
5-7
: Added necessary imports for testing.Imports for
PackageManagerService
,TestUtil
, andPackageSearchService
are added to support the new test scenario. This is essential for accessing the required functionalities in the tests.
116-180
: New test scenario for clearing a blocked package.This test ensures that the functionality for clearing a blocked package from the Elasticsearch index is working as expected. It uses mocks effectively to simulate the environment and checks the correct behavior through assertions.
app/core/service/PackageSearchService.ts (2)
11-11
: Injection ofPackageVersionBlockRepository
.The repository is correctly injected, enabling the service to access block information for packages. This is essential for the new functionality to remove blocked packages from Elasticsearch.
Also applies to: 26-27
44-49
: Handling blocked packages during synchronization.The service now checks if a package is blocked and removes it from Elasticsearch if it is. This is a crucial update for maintaining the integrity of the data in Elasticsearch, aligning with the PR's objectives.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #700 +/- ##
==========================================
+ Coverage 96.80% 96.81% +0.01%
==========================================
Files 181 181
Lines 18030 18002 -28
Branches 2336 2338 +2
==========================================
- Hits 17454 17429 -25
+ Misses 576 573 -3 ☔ View full report in Codecov by Sentry. |
@@ -30,6 +32,7 @@ class SyncESPackage { | |||
} | |||
|
|||
@Event(PACKAGE_UNPUBLISHED) | |||
@Event(PACKAGE_BLOCKED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原来还能叠加来写,学习了。
[skip ci] ## [3.61.5](v3.61.4...v3.61.5) (2024-06-25) ### Bug Fixes * auto remove blocked package on sync process ([#700](#700)) ([ca6ce4e](ca6ce4e))
SyncESPackage
logic for event registersyncPackage
SyncESPackage
逻辑,更新事件注册syncPackage
时,重新判断包是否被 block,用于清理Summary by CodeRabbit
New Features
PACKAGE_BLOCKED
andPACKAGE_UNBLOCKED
for better package management.Bug Fixes
Tests