Spin group wait causes ClosedQueueError
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the regression with test.rb using the minimal SpinGroup example, then inspect lib/cli/ui/work_queue.rb:86 and lib/cli/ui/spinner/spin_group.rb:135, 314-315. Trace why sg.wait closes the queue before the second sg.add enqueues work; done when the example completes both tasks without ClosedQueueError and a regression test covers it.
Written by the indexing model from the issue text.
Description
After updating to 2.2.3 to 2.3.0, waiting in a spingroup seems to have broken and now throws a ClosedQueueError.
Minimal test case:
require 'cli/ui'
CLI::UI::StdoutRouter.enable
CLI::UI::SpinGroup.new do |sg|
# Task 1
sg.add('pending') { |spinner|
result = { 'message' => 'mock api result' }
sleep(0.5)
spinner.update_title(result['message'])
}
# Wait for previous task to finish before starting the next
sg.wait
# Task 2
sg.add('pending 2') { |spinner|
result = { 'message' => 'mock api result 2' }
sleep(0.5)
spinner.update_title(result['message'])
}
end
Full output:
# ruby test.rb
✓ mock api result
/usr/local/bundle/gems/cli-ui-2.3.0/lib/cli/ui/work_queue.rb:86:in `push': queue closed (ClosedQueueError)
from /usr/local/bundle/gems/cli-ui-2.3.0/lib/cli/ui/work_queue.rb:86:in `enqueue'
from /usr/local/bundle/gems/cli-ui-2.3.0/lib/cli/ui/spinner/spin_group.rb:135:in `initialize'
from /usr/local/bundle/gems/cli-ui-2.3.0/lib/cli/ui/spinner/spin_group.rb:315:in `new'
from /usr/local/bundle/gems/cli-ui-2.3.0/lib/cli/ui/spinner/spin_group.rb:315:in `block in add'
from /usr/local/bundle/gems/cli-ui-2.3.0/lib/cli/ui/spinner/spin_group.rb:314:in `synchronize'
from /usr/local/bundle/gems/cli-ui-2.3.0/lib/cli/ui/spinner/spin_group.rb:314:in `add'
from test.rb:17:in `block in <main>'
from /usr/local/bundle/gems/cli-ui-2.3.0/lib/cli/ui/spinner/spin_group.rb:93:in `initialize'
from test.rb:5:in `new'
from test.rb:5:in `<main>'
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 57
- Avg merge
- 2h 55m
- Merged PRs (30d)
- 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/cli-ui
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bensheldon/good_job#1816 · 5 comments ·