Skip to content

Commit

Permalink
Fix count (#197)
Browse files Browse the repository at this point in the history
* fix count

* fix count

---------

Co-authored-by: yushuwang <[email protected]>
  • Loading branch information
wildeslam and yushuwang authored Nov 1, 2023
1 parent 2777f5d commit 774cd64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,10 @@ public void finishCaseByPlan(ReplayPlan replayPlan, int count) {

private void doPlanFinish(ReplayPlan replayPlan, int count) {
String planId = replayPlan.getId();
int endTarget =
replayPlan.isReRun() ? replayPlan.getReRunCaseCount() : replayPlan.getCaseTotalCount();
try {
Long finished = doWithRetry(
() -> redisCacheProvider.incrValueBy(toPlanFinishKeyBytes(planId), count));
if (finished != null && finished == endTarget) {
if (finished != null && finished == replayPlan.getCaseTotalCount()) {
progressEvent.onReplayPlanFinish(replayPlan);
}
} catch (Throwable throwable) {
Expand Down Expand Up @@ -214,9 +212,10 @@ private int byteArrayToInt(byte[] bytes) {
@Override
public void reRunPlan(ReplayPlan replayPlan) {
String planId = replayPlan.getId();
int value = replayPlan.getReRunCaseCount();
byte[] totalKey = toPlanTotalKeyBytes(planId);
setRedisNxWithExpire(totalKey, valueToBytes(value));
int value = replayPlan.getCaseTotalCount() - replayPlan.getReRunCaseCount();

byte[] totalKey = toPlanFinishKeyBytes(planId);
redisCacheProvider.put(totalKey, String.valueOf(value).getBytes(StandardCharsets.UTF_8));
int actionReRunCaseCount;
for (ReplayActionItem replayActionItem : replayPlan.getReplayActionItemList()) {
actionReRunCaseCount = replayActionItem.getRerunCaseCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ public void updateFailedActionAndCase(ReplayPlan replayPlan,

CompletableFuture.allOf(removeRecordsAndScenesTask, batchUpdateStatusTask, noiseAnalysisRecover)
.join();
replayPlan.setReRunCaseCount(newFailedCaseList.size());
}

public void doResumeOperationDescriptor(ReplayPlan replayPlan) {
Expand Down

0 comments on commit 774cd64

Please sign in to comment.