-
-
Notifications
You must be signed in to change notification settings - Fork 20
GH-1147 Make UserManager use UserRepository #1147
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
base: master
Are you sure you want to change the base?
Conversation
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.
Code Review
This pull request refactors the UserManager
to use a repository pattern for data persistence, which is a great improvement. I've identified a few issues, including a critical bug that causes double database writes and a race condition during initial data loading. Additionally, there are opportunities to improve code clarity and maintainability by simplifying some logic and improving API design. The new integration tests are a good addition, but could be improved by removing console output.
eternalcore-core/src/main/java/com/eternalcode/core/user/UserManager.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/user/UserManager.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/user/UserManager.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/user/database/UserRepository.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/user/database/UserRepository.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/main/java/com/eternalcode/core/user/database/UserRepositoryOrmLite.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/test/java/com/eternalcode/core/user/BatchTest.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/test/java/com/eternalcode/core/user/UserBatchFetchTest.java
Outdated
Show resolved
Hide resolved
eternalcore-core/src/test/java/com/eternalcode/core/user/UserBatchFetchTest.java
Outdated
Show resolved
Hide resolved
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.
LGTM
|
||
@Override | ||
public CompletableFuture<Collection<User>> fetchUsersBatch(int batchSize) { | ||
return CompletableFuture.supplyAsync(() -> { |
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.
I think you should supply a custom executor, since you are already using one in all AbstractRepositoryOrmLite
methods
…-manager-database
Methods do not change so #1136 can be merged :>