-
-
Notifications
You must be signed in to change notification settings - Fork 184
feat: Make transport channel capacity configurable #1040
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
911fd9d
d87061c
9c8f904
6f724ba
fbff3ea
94b2f8b
6d1c9ff
c819ce9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,11 +27,11 @@ pub struct TransportThread { | |
|
|
||
| impl TransportThread { | ||
| /// Spawn a new background thread. | ||
| pub fn new<SendFn>(mut send: SendFn) -> Self | ||
| pub fn new<SendFn>(mut send: SendFn, channel_capacity: usize) -> Self | ||
| where | ||
| SendFn: FnMut(Envelope, &mut RateLimiter) + Send + 'static, | ||
| { | ||
| let (sender, receiver) = sync_channel(30); | ||
| let (sender, receiver) = sync_channel(channel_capacity.max(1)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should honor I tested this end-to-end with the clamp removed and |
||
| let shutdown = Arc::new(AtomicBool::new(false)); | ||
| let shutdown_worker = shutdown.clone(); | ||
| let handle = thread::Builder::new() | ||
|
Comment on lines
+46
to
53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: With Suggested FixConsider using Prompt for AI AgentAlso affects:
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,13 +27,13 @@ pub struct TransportThread { | |
|
|
||
| impl TransportThread { | ||
| /// Spawn a new background thread. | ||
| pub fn new<SendFn, SendFuture>(mut send: SendFn) -> Self | ||
| pub fn new<SendFn, SendFuture>(mut send: SendFn, channel_capacity: usize) -> Self | ||
| where | ||
| SendFn: FnMut(Envelope, RateLimiter) -> SendFuture + Send + 'static, | ||
| // NOTE: returning RateLimiter here, otherwise we are in borrow hell | ||
| SendFuture: std::future::Future<Output = RateLimiter>, | ||
| { | ||
| let (sender, receiver) = sync_channel(30); | ||
| let (sender, receiver) = sync_channel(channel_capacity.max(1)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same concept applies here; I tested both transport thread variants with the clamp removed, and both accepted 1 of 10 rapid events with capacity |
||
| let shutdown = Arc::new(AtomicBool::new(false)); | ||
| let shutdown_worker = shutdown.clone(); | ||
| let handle = thread::Builder::new() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.