eco icon indicating copy to clipboard operation
eco copied to clipboard

Fix EcoProfile read method to be asynchronous

Open MillionthOdin16 opened this issue 1 year ago • 11 comments

Fixes #389

Update the read method in PersistentDataHandler to use CompletableFuture for asynchronous operations.

  • Change the read method in PersistentDataHandler.java to return CompletableFuture<T> instead of T.
  • Remove the blocking call future.get() from the read method.
  • Update the read method in EcoProfile.kt to handle the new CompletableFuture return type.
  • Use thenApply to process the result of the CompletableFuture in the read method in EcoProfile.kt.
  • Ensure the read method in EcoProfile.kt returns the default value if the CompletableFuture is null.

MillionthOdin16 avatar Mar 05 '25 03:03 MillionthOdin16

This would break API compatibility surely

WillFP avatar Mar 05 '25 19:03 WillFP

Okay, but what are the alternatives? Just do nothing and accept that every server will lag when it has database storage and many players joining?

twisti-dev avatar Mar 05 '25 19:03 twisti-dev

Ignoring the problem or refusing to fix it isn’t really a solution. The server lagging every time a player joins is a serious issue that directly affects performance and usability. I get that changing the API might have some downsides, but just leaving things as they are right now isn’t really an option for server owners who rely on this plugin. So the server lags every time a player joins, and the solution is… to do nothing? Just because fixing it might be inconvenient? That’s not how problems get solved. I get that modifying the API isn’t ideal, but leaving things broken just because it’s inconvenient to fix isn’t a reasonable approach. @WillFP

JoField08 avatar Mar 08 '25 12:03 JoField08

Any updates on fixing?

TheBjoRedCraft avatar Mar 19 '25 05:03 TheBjoRedCraft

@WillFP

JoField08 avatar Mar 26 '25 15:03 JoField08

any updates?

TheBjoRedCraft avatar Apr 25 '25 21:04 TheBjoRedCraft

Hey! As someone who uses the eco api, i feel like there should be separate async methods & support for callbacks. There are some instances where you would want something to be blocking the thread (very few albeit).

Once that would be done, other plugins can be PR'd and updated accordingly.

refractored avatar Apr 30 '25 01:04 refractored

@WillFP Any updates on this PR / Issue?

ammodev avatar May 09 '25 09:05 ammodev

Any update refering to this? @WillFP

JoField08 avatar Aug 08 '25 15:08 JoField08

@WillFP

JoField08 avatar Sep 29 '25 16:09 JoField08

@WillFP Any update on this? It’s only been... what, forever?

twisti-dev avatar Oct 02 '25 23:10 twisti-dev