summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-06-12 17:52:38 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-06-13 14:12:25 +0200
commit960795064d5eb4a1a69c24950131b10f5abd9886 (patch)
tree66468336d7355f4ffd520000c8054863e8ee0321
parent02edcb618f78626e29827a6100419eb11f0f86a5 (diff)
downloadbundler-improve_worker_shutdown.tar.gz
-rw-r--r--lib/bundler/fetcher/compact_index.rb11
-rw-r--r--lib/bundler/worker.rb7
2 files changed, 8 insertions, 10 deletions
diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb
index 745cc94c1b..9a86dc1e3c 100644
--- a/lib/bundler/fetcher/compact_index.rb
+++ b/lib/bundler/fetcher/compact_index.rb
@@ -93,15 +93,8 @@ module Bundler
func = lambda {|object, _index| blk.call(object) }
worker = bundle_worker(func)
inputs.each {|input| worker.enq(input) }
-
- results = []
-
- begin
- results = inputs.map { worker.deq }
- ensure
- worker.stop
- end
-
+ results = inputs.map { worker.deq }
+ worker.stop
results
end
diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb
index 3471654b43..8ce8c6bd7b 100644
--- a/lib/bundler/worker.rb
+++ b/lib/bundler/worker.rb
@@ -40,7 +40,12 @@ module Bundler
# Retrieves results of job function being executed in worker pool
def deq
result = @response_queue.deq
- raise result.exception if result.is_a?(WrappedException)
+
+ if result.is_a?(WrappedException)
+ stop
+ raise result.exception
+ end
+
result
end