Skip to content

Commit

Permalink
fix(redis): Actually persist startTimeTtl (#2134)
Browse files Browse the repository at this point in the history
  • Loading branch information
robzienert committed Apr 9, 2018
1 parent 0223634 commit 1257c50
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import javax.annotation.Nonnull;
import java.io.IOException;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -514,6 +515,9 @@ protected Execution buildExecution(@Nonnull Execution execution, @Nonnull Map<St
execution.setLimitConcurrent(Boolean.parseBoolean(map.get("limitConcurrent")));
execution.setBuildTime(NumberUtils.createLong(map.get("buildTime")));
execution.setStartTime(NumberUtils.createLong(map.get("startTime")));
if (map.get("startTimeTtl") != null) {
execution.setStartTimeTtl(Instant.ofEpochMilli(Long.valueOf(map.get("startTimeTtl"))));
}
execution.setEndTime(NumberUtils.createLong(map.get("endTime")));
if (map.get("status") != null) {
execution.setStatus(ExecutionStatus.valueOf(map.get("status")));
Expand Down Expand Up @@ -542,6 +546,9 @@ protected Execution buildExecution(@Nonnull Execution execution, @Nonnull Map<St
stage.setStartTime(NumberUtils.createLong(map.get(prefix + "startTime")));
stage.setEndTime(NumberUtils.createLong(map.get(prefix + "endTime")));
stage.setStatus(ExecutionStatus.valueOf(map.get(prefix + "status")));
if (map.get(prefix + "startTimeTtl") != null) {
stage.setStartTimeTtl(Instant.ofEpochMilli(Long.valueOf(map.get(prefix + "startTimeTtl"))));
}
if (map.get(prefix + "syntheticStageOwner") != null) {
stage.setSyntheticStageOwner(SyntheticStageOwner.valueOf(map.get(prefix + "syntheticStageOwner")));
}
Expand Down Expand Up @@ -635,6 +642,7 @@ protected Map<String, String> serializeExecution(@Nonnull Execution execution) {
map.put("buildTime", String.valueOf(execution.getBuildTime() != null ? execution.getBuildTime() : 0L));
map.put("startTime", execution.getStartTime() != null ? execution.getStartTime().toString() : null);
map.put("endTime", execution.getEndTime() != null ? execution.getEndTime().toString() : null);
map.put("startTimeTtl", execution.getStartTimeTtl() != null ? String.valueOf(execution.getStartTimeTtl().toEpochMilli()) : null);
map.put("status", execution.getStatus().name());
map.put("authentication", mapper.writeValueAsString(execution.getAuthentication()));
map.put("paused", mapper.writeValueAsString(execution.getPaused()));
Expand Down Expand Up @@ -670,6 +678,7 @@ protected Map<String, String> serializeStage(Stage stage) {
map.put(prefix + "name", stage.getName());
map.put(prefix + "startTime", stage.getStartTime() != null ? stage.getStartTime().toString() : null);
map.put(prefix + "endTime", stage.getEndTime() != null ? stage.getEndTime().toString() : null);
map.put(prefix + "startTimeTtl", stage.getStartTimeTtl() != null ? String.valueOf(stage.getStartTimeTtl().toEpochMilli()) : null);
map.put(prefix + "status", stage.getStatus().name());
map.put(prefix + "syntheticStageOwner", stage.getSyntheticStageOwner() != null ? stage.getSyntheticStageOwner().name() : null);
map.put(prefix + "parentStageId", stage.getParentStageId());
Expand Down

0 comments on commit 1257c50

Please sign in to comment.