From 960c5cc52bb865ee56299824eb21f4d2998ed62b Mon Sep 17 00:00:00 2001 From: Sam Van Oort Date: Thu, 22 Mar 2018 15:19:23 -0400 Subject: [PATCH] Remove redundant save operations from graphListener if durability setting permits --- .../jenkinsci/plugins/workflow/job/WorkflowRun.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java b/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java index 49b92373..8ec152b1 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java @@ -1022,10 +1022,12 @@ private final class GraphL implements GraphListener { if (node instanceof FlowEndNode) { finish(((FlowEndNode) node).getResult(), execution != null ? execution.getCauseOfFailure() : null); } else { - try { - save(); - } catch (IOException x) { - LOGGER.log(Level.WARNING, null, x); + if (execution != null && execution.getDurabilityHint().isPersistWithEveryStep()) { + try { + save(); + } catch (IOException x) { + LOGGER.log(Level.WARNING, null, x); + } } } }