mirror of https://github.com/tikv/client-java.git
fix slowlog in ConcreteBackOffer (#443)
Signed-off-by: marsishandsome <marsishandsome@gmail.com>
This commit is contained in:
parent
96d39e8aa3
commit
d14713a961
|
@ -168,6 +168,8 @@ public class ConcreteBackOffer implements BackOffer {
|
|||
}
|
||||
|
||||
public boolean canRetryAfterSleep(BackOffFunction.BackOffFuncType funcType, long maxSleepMs) {
|
||||
Histogram.Timer backOffTimer = BACKOFF_DURATION.labels(funcType.name()).startTimer();
|
||||
SlowLogSpan slowLogSpan = getSlowLog().start("backoff " + funcType.name());
|
||||
BackOffFunction backOffFunction =
|
||||
backOffFunctionMap.computeIfAbsent(funcType, this::createBackOffFunc);
|
||||
|
||||
|
@ -179,12 +181,12 @@ public class ConcreteBackOffer implements BackOffer {
|
|||
long currentMs = System.currentTimeMillis();
|
||||
if (currentMs + sleep >= deadline) {
|
||||
logger.warn(String.format("Deadline %d is exceeded, errors:", deadline));
|
||||
slowLogSpan.end();
|
||||
backOffTimer.observeDuration();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Histogram.Timer backOffTimer = BACKOFF_DURATION.labels(funcType.name()).startTimer();
|
||||
SlowLogSpan slowLogSpan = getSlowLog().start("backoff " + funcType.name());
|
||||
try {
|
||||
Thread.sleep(sleep);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
Loading…
Reference in New Issue