Skip to content

Fixes incorrect clearing of old states in queue's event objects #41

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

Merged
merged 1 commit into from
Aug 6, 2020
Merged

Fixes incorrect clearing of old states in queue's event objects #41

merged 1 commit into from
Aug 6, 2020

Conversation

dbadrian
Copy link
Contributor

@dbadrian dbadrian commented Aug 5, 2020

Queue utilizes events to wait for a new element to be added if queue was empty or wait for an element to be removed before putting a new one if it was full.

However, events can be set for previous iterations and not cleared correctly, causing either exceptions (get case) or "overflow" queue for putting with size limited queues.. See #40 for more details.

Based on the discussion there, I propose to just shift the 'clear'-calls already present by one line. We don't really care about the event state anywhere but in those locations, thus having some old state left, isn't too bad. We don't check/require it elsewhere.

TBH. I feel like it would be nice to have the event object actually have a function call "clear_and_wait", but that might be unreasonable elsewhere. Thus this fix for now.

@peterhinch
Copy link
Owner

You are right. I thought I'd spotted a loophole yesterday morning, but your solution actually fixes it.

Thank you for this.

@peterhinch peterhinch merged commit 6802cb4 into peterhinch:master Aug 6, 2020
@dbadrian dbadrian deleted the fix/queue_event_clearing branch August 6, 2020 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants