Skip to content

Commit

Permalink
sleep after read
Browse files Browse the repository at this point in the history
  • Loading branch information
qifanwang committed Dec 25, 2024
1 parent 496ea2f commit b0942c1
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ public OffsetCommandReader(CommandFile commandFile, long globalPosition, long fi
@Override
public ReferenceFileRegion doRead(long milliSeconds) throws IOException {
try {
long delayMilli;
if (null != replDelayConfig && (delayMilli = replDelayConfig.getDelayMilli()) > 0) {
logger.debug("[readDelay]{}", delayMilli);
offsetNotifier.await(curPosition, milliSeconds);
Thread.sleep(delayMilli);
} else if (milliSeconds >= 0) {
if (milliSeconds >= 0) {
offsetNotifier.await(curPosition, milliSeconds);
} else {
offsetNotifier.await(curPosition);
Expand All @@ -75,6 +70,14 @@ public ReferenceFileRegion doRead(long milliSeconds) throws IOException {
if (referenceFileRegion.count() < 0) {
logger.error("[read]{}", referenceFileRegion);
}
long delayMilli;
if (null != replDelayConfig && (delayMilli = replDelayConfig.getDelayMilli()) > 0) {
logger.debug("[readDelay]{}", delayMilli);
try {
Thread.sleep(delayMilli);
} catch (InterruptedException e) {
}
}

return referenceFileRegion;
}
Expand Down

0 comments on commit b0942c1

Please sign in to comment.