Add "grace" parameter to the FastBreak config to replace

buckets.contention.

For compatibility buckets.contention is still read and the maximum of
both
is
used.
This commit is contained in:
asofold 2012-11-15 11:39:23 +01:00
parent b4302edc48
commit 34d6f2ff31
4 changed files with 5 additions and 3 deletions

View File

@ -79,7 +79,7 @@ public class BlockBreakConfig extends ACheckConfig {
public final int fastBreakBuckets;
public final long fastBreakBucketDur;
public final float fastBreakBucketFactor;
public final long fastBreakBucketContention;
public final long fastBreakGrace;
public final long fastBreakDelay;
public final int fastBreakModSurvival;
public final int fastBreakModCreative;
@ -125,7 +125,7 @@ public class BlockBreakConfig extends ACheckConfig {
// Hidden settings of new check.
fastBreakDebug = data.getBoolean(ConfPaths.BLOCKBREAK_FASTBREAK_DEBUG, false);
fastBreakDelay = data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_DELAY);
fastBreakBucketContention = data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_CONTENTION, 2000);
fastBreakGrace = Math.max(data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_CONTENTION, 2000), data.getLong(ConfPaths.BLOCKBREAK_FASTBREAK_GRACE));
fastBreakBucketDur = data.getInt(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_DUR, 4000);
fastBreakBucketFactor = (float) data.getDouble(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_FACTOR, 0.99);
fastBreakBuckets = data.getInt(ConfPaths.BLOCKBREAK_FASTBREAK_BUCKETS_N, 30);

View File

@ -74,7 +74,7 @@ public class FastBreak extends Check {
data.fastBreakPenalties.add(now, (float) missingTime);
// Only raise a violation, if the total penalty score exceeds the contention duration (for lag, delay).
if (data.fastBreakPenalties.score(cc.fastBreakBucketFactor) > cc.fastBreakBucketContention){
if (data.fastBreakPenalties.score(cc.fastBreakBucketFactor) > cc.fastBreakGrace){
// TODO: maybe add one absolute penalty time for big amounts to stop breaking until then
final double vlAdded = (double) missingTime / 1000.0;
data.fastBreakVL += vlAdded;

View File

@ -88,6 +88,7 @@ public abstract class ConfPaths {
public static final String BLOCKBREAK_FASTBREAK_BUCKETS_DUR = BLOCKBREAK_FASTBREAK_BUCKETS + "duration";
public static final String BLOCKBREAK_FASTBREAK_BUCKETS_FACTOR = BLOCKBREAK_FASTBREAK_BUCKETS + "factor";
public static final String BLOCKBREAK_FASTBREAK_DELAY = BLOCKBREAK_FASTBREAK + "delay";
public static final String BLOCKBREAK_FASTBREAK_GRACE = BLOCKBREAK_FASTBREAK + "grace";
public static final String BLOCKBREAK_FASTBREAK_MOD_CREATIVE = BLOCKBREAK_FASTBREAK + "intervalcreative";
public static final String BLOCKBREAK_FASTBREAK_MOD_SURVIVAL = BLOCKBREAK_FASTBREAK + "intervalsurvival";
public static final String BLOCKBREAK_FASTBREAK_ACTIONS = BLOCKBREAK_FASTBREAK + "actions";

View File

@ -84,6 +84,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.BLOCKBREAK_FASTBREAK_CHECK, true);
set(ConfPaths.BLOCKBREAK_FASTBREAK_DELAY, 90);
set(ConfPaths.BLOCKBREAK_FASTBREAK_MOD_SURVIVAL, 100);
set(ConfPaths.BLOCKBREAK_FASTBREAK_GRACE, 2000);
set(ConfPaths.BLOCKBREAK_FASTBREAK_ACTIONS, "cancel vl>0 log:fastbreak:3:5:cif cancel");
set(ConfPaths.BLOCKBREAK_FREQUENCY_CHECK, true);