Fix EcoProfile read method to be asynchronous
Fixes #389
Update the read method in PersistentDataHandler to use CompletableFuture for asynchronous operations.
- Change the
readmethod inPersistentDataHandler.javato returnCompletableFuture<T>instead ofT. - Remove the blocking call
future.get()from thereadmethod. - Update the
readmethod inEcoProfile.ktto handle the newCompletableFuturereturn type. - Use
thenApplyto process the result of theCompletableFuturein thereadmethod inEcoProfile.kt. - Ensure the
readmethod inEcoProfile.ktreturns the default value if theCompletableFutureis null.
This would break API compatibility surely
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?
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
Any updates on fixing?
@WillFP
any updates?
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.
@WillFP Any updates on this PR / Issue?
Any update refering to this? @WillFP
@WillFP
@WillFP Any update on this? It’s only been... what, forever?