Skip to content
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

Turning from Unbounded AsyncQueue to Bounded AsyncQueue #1330

Open
carvalhof opened this issue Jul 12, 2024 · 0 comments
Open

Turning from Unbounded AsyncQueue to Bounded AsyncQueue #1330

carvalhof opened this issue Jul 12, 2024 · 0 comments
Assignees
Labels
enhancement Enhancement Request on an Existing Feature

Comments

@carvalhof
Copy link
Collaborator

Context

Currently, AsyncQueue is unbounded, which can cause the queue to grow indefinitely.

Proposed Solution

One solution would be to use the ArrayDeque of crate::arraydeque and restrict the queue to a fixed value (e.g., 1024). This change maintains the insertion and removal operations that are already in the AsyncQueue, such as push_back, push_front, and pop_front, in addition to basic operations such as len, is_empty, iter, and iter_mut.

Another enhancement involves the use of the Saturating parameter. This feature ensures that when the queue reaches its maximum capacity, any new elements will be automatically discarded, preventing the queue from growing beyond its set limit.

@carvalhof carvalhof added the enhancement Enhancement Request on an Existing Feature label Jul 12, 2024
@iyzhang iyzhang self-assigned this Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement Request on an Existing Feature
Projects
None yet
Development

No branches or pull requests

2 participants