From df71bfa3abb0f628822dc0ec4e3a0a657cf0bbf6 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 15 Jun 2012 18:12:43 +0200 Subject: [PATCH] feature #1303: downloader retries writing when the uncompress command is busy --- src/datastore_mad/remotes/downloader.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/datastore_mad/remotes/downloader.rb b/src/datastore_mad/remotes/downloader.rb index df2fa57140..96203176d1 100755 --- a/src/datastore_mad/remotes/downloader.rb +++ b/src/datastore_mad/remotes/downloader.rb @@ -89,9 +89,18 @@ class Stream def process(data) begin - @compr_in.write(data) - @compr_in.flush - rescue Errno::EPIPE + try=5 + begin + @compr_in.write(data) + @compr_in.flush + rescue + if try>0 + try-=1 + sleep 0.1 + retry + end + end + rescue STDERR.puts "Error uncompressing image." exit(-1) end