Skip to content

Commit 0486393

Browse files
committed
Merge branch 'feat/disk-cache' into deployment/test
2 parents 416cce3 + cfcbaf3 commit 0486393

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/chunk_cache.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ impl ChunkCache {
4444
} else {
4545
None
4646
};
47+
// Size of the MPSC channel buffer, i.e. how many chunks we can queue.
48+
let chunk_cache_queue_size = args.chunk_cache_queue_size.unwrap_or(32);
4749

4850
let cache = Arc::new(SimpleDiskCache::new(
4951
"chunk_cache",
@@ -53,7 +55,7 @@ impl ChunkCache {
5355
max_size_bytes
5456
));
5557
let cache_clone = cache.clone();
56-
let (sender, mut receiver) = mpsc::channel::<KeyValueMessage>(32);
58+
let (sender, mut receiver) = mpsc::channel::<KeyValueMessage>(chunk_cache_queue_size);
5759
spawn(async move {
5860
while let Some(message) = receiver.recv().await {
5961
cache_clone.set(message.key.as_str(), message.value).await.unwrap();

src/cli.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ pub struct CommandLineArgs {
6969
/// Default when unset is unlimited.
7070
#[arg(long, env = "REDUCTIONIST_CHUNK_CACHE_SIZE_LIMIT")]
7171
pub chunk_cache_size_limit: Option<String>,
72+
/// Optional buffer size for queuing commits to the cache.
73+
/// Default is 32.
74+
#[arg(long, env = "REDUCTIONIST_CHUNK_CACHE_QUEUE_SIZE")]
75+
pub chunk_cache_queue_size: Option<usize>,
7276
}
7377

7478
/// Returns parsed command line arguments.

0 commit comments

Comments
 (0)