3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-24 18:10:08 +01:00

Correctly queue edits

Synchronising on the LocalSession ends up being dangerous as it's a craftbukkit thread, leading to blocking issues if something goes wrong in an edit, made worse by the fact craftbukkit threads like to interfere with each other sometimes, and also cause OOMs and hanging when there are too many of them.
Dieser Commit ist enthalten in:
dordsor21 2020-10-08 10:53:57 +01:00
Ursprung a64a1ab09e
Commit 2c27b9c02a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
4 geänderte Dateien mit 10 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -79,8 +79,8 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
private final Map<String, Object> meta;
// Queue for async tasks
private AtomicInteger runningCount = new AtomicInteger();
private AsyncNotifyQueue asyncNotifyQueue = new AsyncNotifyQueue(
private final AtomicInteger runningCount = new AtomicInteger();
private final AsyncNotifyQueue asyncNotifyQueue = new AsyncNotifyQueue(
(thread, throwable) -> {
while (throwable.getCause() != null) {
throwable = throwable.getCause();

Datei anzeigen

@ -189,12 +189,12 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
*/
default boolean confirm() {
InterruptableCondition confirm = deleteMeta("cmdConfirm");
if (confirm != null) {
confirm.signal();;
return true;
}
if (confirm == null) {
return false;
}
queueAction(confirm::signal);
return true;
}
/**
* Queue an action to run async.

Datei anzeigen

@ -649,13 +649,12 @@ public final class PlatformCommandManager {
} else {
actor.decline();
}
LocalSession session = worldEdit.getSessionManager().get(actor);
synchronized (session) {
actor.runAction(() -> {
SessionKey key = actor.getSessionKey();
if (key.isActive()) {
PlatformCommandManager.this.handleCommandOnCurrentThread(event);
}
}
}, false, true);
}, Fawe.isMainThread());
}