From e2714fb56e854f4aef0d918a89690c3127981465 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 21 Jul 2014 23:09:16 +0900 Subject: [PATCH] Retry in 3 seconds --- plug.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index 14f6d9d..a008a6a 100644 --- a/plug.vim +++ b/plug.vim @@ -693,7 +693,15 @@ function! s:update_parallel(pull, todo, threads) pids.each { |pid| Process.kill 'TERM', pid.to_i rescue nil } fd.close end - retry if e.is_a?(Timeout::Error) && tried < tries + if e.is_a?(Timeout::Error) && tried < tries + 3.downto(1) do |countdown| + s = countdown > 1 ? 's' : '' + log.call name, "Timeout. Will retry in #{countdown} second#{s} ...", type + sleep 1 + end + log.call name, 'Retrying ...', type + retry + end [false, e.is_a?(Interrupt) ? "Interrupted!" : "Timeout!"] end }