Skip to content

Conversation

@CitralFlo
Copy link
Member

@CitralFlo CitralFlo commented Aug 30, 2025

Methods do not change so #1136 can be merged :>

@CitralFlo CitralFlo requested a review from a team as a code owner August 30, 2025 20:27
@CitralFlo CitralFlo changed the title User Manager uses repository now! GH-1147 User Manager uses repository now! Aug 30, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

@CitralFlo CitralFlo requested a review from sadcenter September 1, 2025 19:59
@CitralFlo CitralFlo marked this pull request as draft September 1, 2025 21:29
Copy link

@sadcenter sadcenter left a 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(() -> {
Copy link

@sadcenter sadcenter Sep 6, 2025

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

@Jakubk15 Jakubk15 changed the title GH-1147 User Manager uses repository now! GH-1147 Make UserManager use UserRepository Sep 28, 2025
Copy link
Member

@Rollczi Rollczi left a comment

Choose a reason for hiding this comment

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

chyba tam testy wybuchają i takie tam

+ "database type "
+ "to be used."})
public DatabaseDriverType databaseType = DatabaseDriverType.SQLITE;
public DatabaseDriverType databaseType = DatabaseDriverType.MYSQL;
Copy link
Member

Choose a reason for hiding this comment

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

hm czemu tak? jak w testach coś nie gra to settuj fielda jest public

SQLITE(SQLITE_DRIVER, SQLITE_JDBC_URL);
SQLITE(SQLITE_DRIVER, SQLITE_JDBC_URL),

H2_TEST(H2_DRIVER, "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=MYSQL");
Copy link
Member

Choose a reason for hiding this comment

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

raczej bym unikał dodawania kawałków kodu które są tylko dla testów, jaki tutaj był problem? może da się to lepiej rozwiązać?


@EventHandler
public void onJoin(PlayerJoinEvent event) {
this.userManager.fetchUser(event.getPlayer().getUniqueId());
Copy link
Member

Choose a reason for hiding this comment

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

a jak ci userzy są tworzeni?

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.

4 participants