kibana/vars/retryWithDelay.groovy

19 lines
419 B
Groovy
Raw Normal View History

def call(retryTimes, delaySecs, closure) {
retry(retryTimes) {
try {
closure()
2020-03-02 21:04:27 +01:00
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException ex) {
throw ex // Immediately re-throw build abort exceptions, don't sleep first
} catch (Exception ex) {
sleep delaySecs
throw ex
}
}
}
def call(retryTimes, Closure closure) {
call(retryTimes, 15, closure)
}
return this