mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-15 08:28:10 +02:00
Adjust Metrics.
1. Removed setting timeouts explicitly. 2. Schedule logging the error before throwing the exception.
This commit is contained in:
parent
73cbac3b8f
commit
7d5e5deb24
@ -34,6 +34,8 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.logging.LogUtil;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -432,9 +434,9 @@ public class Metrics {
|
|||||||
} else {
|
} else {
|
||||||
connection = url.openConnection();
|
connection = url.openConnection();
|
||||||
}
|
}
|
||||||
// NCP: Set timeouts.
|
// // NCP: Set timeouts.
|
||||||
connection.setConnectTimeout(8000);
|
// connection.setConnectTimeout(8000);
|
||||||
connection.setReadTimeout(16000);
|
// connection.setReadTimeout(16000);
|
||||||
|
|
||||||
connection.setDoOutput(true);
|
connection.setDoOutput(true);
|
||||||
|
|
||||||
@ -462,6 +464,7 @@ public class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (response == null || response.startsWith("ERR")) {
|
if (response == null || response.startsWith("ERR")) {
|
||||||
|
LogUtil.scheduleLogWarning("[NoCheatPlus] Metrics error: " + response);
|
||||||
throw new IOException(response); //Throw the exception
|
throw new IOException(response); //Throw the exception
|
||||||
} else {
|
} else {
|
||||||
// Is this the first update this hour?
|
// Is this the first update this hour?
|
||||||
|
Loading…
Reference in New Issue
Block a user