mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-27 18:41:28 +01:00
More informative permission lag notices.
This commit is contained in:
parent
b7704a4ea8
commit
4f72ff47bc
@ -39,7 +39,7 @@ public class PermissionsHandler implements IPermissionsHandler {
|
|||||||
if (group == null) {
|
if (group == null) {
|
||||||
group = defaultGroup;
|
group = defaultGroup;
|
||||||
}
|
}
|
||||||
checkPermLag(start);
|
checkPermLag(start, String.format("Getting group for %s", base.getName()));
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class PermissionsHandler implements IPermissionsHandler {
|
|||||||
if (groups == null || groups.isEmpty()) {
|
if (groups == null || groups.isEmpty()) {
|
||||||
groups = Collections.singletonList(defaultGroup);
|
groups = Collections.singletonList(defaultGroup);
|
||||||
}
|
}
|
||||||
checkPermLag(start);
|
checkPermLag(start, String.format("Getting groups for %s", base.getName()));
|
||||||
return Collections.unmodifiableList(groups);
|
return Collections.unmodifiableList(groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class PermissionsHandler implements IPermissionsHandler {
|
|||||||
public boolean inGroup(final Player base, final String group) {
|
public boolean inGroup(final Player base, final String group) {
|
||||||
final long start = System.nanoTime();
|
final long start = System.nanoTime();
|
||||||
final boolean result = handler.inGroup(base, group);
|
final boolean result = handler.inGroup(base, group);
|
||||||
checkPermLag(start);
|
checkPermLag(start, String.format("Checking if %s is in group %s", base.getName(), group));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public class PermissionsHandler implements IPermissionsHandler {
|
|||||||
if (prefix == null) {
|
if (prefix == null) {
|
||||||
prefix = "";
|
prefix = "";
|
||||||
}
|
}
|
||||||
checkPermLag(start);
|
checkPermLag(start, String.format("Getting prefix for %s", base.getName()));
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ public class PermissionsHandler implements IPermissionsHandler {
|
|||||||
if (suffix == null) {
|
if (suffix == null) {
|
||||||
suffix = "";
|
suffix = "";
|
||||||
}
|
}
|
||||||
checkPermLag(start);
|
checkPermLag(start, String.format("Getting suffix for %s", base.getName()));
|
||||||
return suffix;
|
return suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,10 +194,14 @@ public class PermissionsHandler implements IPermissionsHandler {
|
|||||||
return handler.getClass().getSimpleName().replace("Handler", "");
|
return handler.getClass().getSimpleName().replace("Handler", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPermLag(long start) {
|
private void checkPermLag(long start, String summary) {
|
||||||
final long elapsed = System.nanoTime() - start;
|
final long elapsed = System.nanoTime() - start;
|
||||||
if (elapsed > ess.getSettings().getPermissionsLagWarning()) {
|
if (elapsed > ess.getSettings().getPermissionsLagWarning()) {
|
||||||
ess.getLogger().log(Level.INFO, "Lag Notice - Slow Permissions System (" + getName() + ") Response - Request took over {0}ms!", elapsed / 1000000.0);
|
ess.getLogger().log(Level.WARNING, String.format("Permissions lag notice with (%s). Response took %fms. Summary: %s", getName(), elapsed / 1000000.0, summary));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkPermLag(long start) {
|
||||||
|
checkPermLag(start, "not defined");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user