From 35e95c3a431792e96e545ac5c519238eee85eb64 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 9 Dec 2012 14:03:34 +0000 Subject: [PATCH] * added optional wait interval for retry{ ... } --- source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy index 327623e4..13a395ed 100644 --- a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy +++ b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy @@ -365,7 +365,7 @@ def tryQuietly(c) { /** * Retry given closure until it returns successfully (indefinitely by default) */ -def retry(n = -1, quiet = false, c) { +def retry(n = -1, wait = 0, quiet = false, c) { for(int i = 0; n < 0 || i <= n; i++) { try { return c.call() @@ -375,6 +375,7 @@ def retry(n = -1, quiet = false, c) { } else if (!quiet) { _log.warning("retry $i: ${e.class.simpleName}: ${e.message}") } + sleep(wait) } } }