mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-02 08:25:02 -04:00
* added optional wait interval for retry{ ... }
This commit is contained in:
parent
b770ecb6af
commit
35e95c3a43
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user