Ensure thread-pool shutdown.
This commit is contained in:
parent
69a04bd249
commit
b68ee4142f
@ -301,6 +301,8 @@ module Homebrew
|
|||||||
# FIXME: Implement cancellation of running downloads.
|
# FIXME: Implement cancellation of running downloads.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
download_queue.cancel
|
||||||
|
|
||||||
if previous_pending_line_count.positive?
|
if previous_pending_line_count.positive?
|
||||||
$stdout.print Tty.move_cursor_down(previous_pending_line_count - 1)
|
$stdout.print Tty.move_cursor_down(previous_pending_line_count - 1)
|
||||||
$stdout.flush
|
$stdout.flush
|
||||||
@ -314,7 +316,7 @@ module Homebrew
|
|||||||
$stdout.flush
|
$stdout.flush
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
download_queue.shutdown
|
download_queue.shutdown
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -28,9 +28,18 @@ module Homebrew
|
|||||||
# rubocop:enable Lint/ShadowingOuterLocalVariable
|
# rubocop:enable Lint/ShadowingOuterLocalVariable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { void }
|
||||||
|
def cancel
|
||||||
|
# FIXME: Implement graceful cancellaction of running downloads based on
|
||||||
|
# https://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Cancellation.html
|
||||||
|
# instead of killing the whole thread pool.
|
||||||
|
pool.kill
|
||||||
|
end
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def shutdown
|
def shutdown
|
||||||
pool.shutdown
|
pool.shutdown
|
||||||
|
pool.wait_for_termination
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user