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

Fix many files bug #920

Merged
merged 2 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ mod tests {
let num_files = [10, 100, 1000, 10000];
for num in num_files {
println!("NUM_FILES: {num}");
let file_opts = (0..num).map(|i| (i.to_string(), 10)).collect();
let file_opts = (0..num)
.map(|i| {
// use a long file name to test large collections
let name = i.to_string().repeat(50);
(name, 10)
})
.collect();
transfer_random_data(file_opts).await?;
}
Ok(())
Expand Down
5 changes: 2 additions & 3 deletions src/provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use quic_rpc::server::RpcChannel;
use quic_rpc::transport::flume::FlumeConnection;
use quic_rpc::transport::misc::DummyServerEndpoint;
use quic_rpc::{RpcClient, RpcServer, ServiceConnection, ServiceEndpoint};
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt};
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::sync::{broadcast, mpsc};
use tokio::task::JoinError;
use tokio_util::io::SyncIoBridge;
Expand Down Expand Up @@ -749,8 +749,7 @@ async fn transfer_collection(
)
.await?;

let mut data = BytesMut::from(&encoded[..]);
writer.write_buf(&mut data).await?;
writer.write_all(&encoded).await?;
for (i, blob) in c.blobs().iter().enumerate() {
debug!("writing blob {}/{}", i, c.blobs().len());
tokio::task::yield_now().await;
Expand Down