Skip to content

Commit

Permalink
Fix server deadlock caused by unhandled lossy division operations
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed May 8, 2024
1 parent c0916bb commit 1b22117
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/gripe/_90/appliede/me/service/EMCStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@ public long extract(AEKey what, long amount, Actionable mode, IActionSource sour
var providers = new ArrayList<IKnowledgeProvider>();

if (source.player().isPresent() && AppliedEConfig.CONFIG.terminalExtractFromOwnEmcOnly()) {
providers.add(
service.getProviderFor(source.player().get().getUUID()).get());
var provider = service.getProviderFor(source.player().get().getUUID());
providers.add(provider.get());
} else {
providers.addAll(service.getProviders());
}

amount = amount / providers.size() * providers.size();

while (!providers.isEmpty() && extracted < amount) {
Collections.shuffle(providers);

Expand Down

0 comments on commit 1b22117

Please sign in to comment.