Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 07:40:13 +01:00
Delay sending stats to bStats for 3-5 minutes after server startup
Dieser Commit ist enthalten in:
Ursprung
eb3868d911
Commit
07b95d46ac
@ -18,6 +18,7 @@ import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
@ -33,6 +34,8 @@ import org.asynchttpclient.Response;
|
||||
*/
|
||||
public class Metrics {
|
||||
|
||||
private static final int ONE_MINUTE_MS = 60_000;
|
||||
|
||||
// The version of this bStats class
|
||||
private static final int B_STATS_METRICS_REVISION = 2;
|
||||
|
||||
@ -96,12 +99,14 @@ public class Metrics {
|
||||
*/
|
||||
private void startSubmitting() {
|
||||
final Timer timer = new Timer(true);
|
||||
long initialDelay = ONE_MINUTE_MS * 3 + (((long) (ThreadLocalRandom.current().nextDouble() * 2
|
||||
* ONE_MINUTE_MS)));
|
||||
timer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
submitData();
|
||||
}
|
||||
}, 1000, 1000 * 60 * 30);
|
||||
}, initialDelay, 1000 * 60 * 30);
|
||||
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough
|
||||
// time to start.
|
||||
//
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren