File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments