-
-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to close a queue. #573
Conversation
I'm not sure about this change. The one part I'm specifically worried about is what is supposed to happen when the queue still holds data in its buffer. In this implementation, the getters never get a chance to consume that data. I'm not entirely sure of the full range of use cases for this API, but I can imagine that some might instead want the queue to be closed on the consuming side only when it's empty. |
Codecov Report
@@ Coverage Diff @@
## master #573 +/- ##
==========================================
- Coverage 99.27% 94.78% -4.49%
==========================================
Files 89 95 +6
Lines 10628 13410 +2782
Branches 747 1495 +748
==========================================
+ Hits 10551 12711 +2160
- Misses 59 641 +582
- Partials 18 58 +40
Continue to review full report at Codecov.
|
@sorcio Seconded. A closed queue should behave like a closed file descriptor – you can read what's been sent before closing but you can't send new things. |
There's an ambiguity that's baked into Queue combining both the send and receive ends onto the same object. If you think of One option would be to have separate I think that probably in the long run we do want to refactor queue into a two-object design, but if you need this functionality urgently then maybe it'd be easiest to call it |
The queue now has two methods:
Also, |
I made it so that the get side automatically closes if there's no data and the put side is closed, because otherwise it would let the queue block forever. |
(The failing Jenkins is because Python segfaulted.) |
@Fuyukai there are a few cases that you're not testing and I suspect there might be a bug there. I cannot thing straight enough right now but let me just drop some notes.
|
I'm going to sleep on this one... in the mean time, probably anyone interested in this will also be interested in #586 :-) |
@Fuyukai oh right, sorry that took longer than expected... thanks for your patience here. |
(Oh right, and the context for the record: this is being closed in favor of #586) |
No description provided.