Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
ScoreboardUpdater: Quick fix to lessen CPU usage (#1238)
This prevents one/multiple CPU cores from taking up 100% usage. A better, permanent fix will replace this in the coming days.
Dieser Commit ist enthalten in:
Ursprung
2f9ff0c622
Commit
b5f6ada4ae
@ -31,6 +31,7 @@ import org.geysermc.connector.network.session.GeyserSession;
|
|||||||
import org.geysermc.connector.network.session.cache.WorldCache;
|
import org.geysermc.connector.network.session.cache.WorldCache;
|
||||||
import org.geysermc.connector.utils.LanguageUtils;
|
import org.geysermc.connector.utils.LanguageUtils;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class ScoreboardUpdater extends Thread {
|
public class ScoreboardUpdater extends Thread {
|
||||||
@ -61,7 +62,7 @@ public class ScoreboardUpdater extends Thread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (!session.isClosed()) {
|
if (!session.isClosed()) {
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
// reset score-packets per second every second
|
// reset score-packets per second every second
|
||||||
@ -99,6 +100,8 @@ public class ScoreboardUpdater extends Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session.getConnector().getGeneralThreadPool().schedule(this, 50, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren