File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ use std::{
1313 time:: Duration ,
1414} ;
1515
16+ use cmd_util:: env:: env_config;
1617use common:: {
1718 self ,
1819 backoff:: Backoff ,
@@ -116,6 +117,9 @@ static ENTRIES_PER_SECOND: LazyLock<NonZeroU32> = LazyLock::new(|| {
116117 . unwrap ( )
117118} ) ;
118119
120+ static INDEX_WORKER_SLEEP_TIME : LazyLock < Duration > =
121+ LazyLock :: new ( || Duration :: from_millis ( env_config ( "INDEX_WORKER_SLEEP_TIME_MS" , 0 ) ) ) ;
122+
119123pub struct IndexWorker < RT : Runtime > {
120124 database : Database < RT > ,
121125 index_writer : IndexWriter < RT > ,
@@ -756,6 +760,9 @@ impl<RT: Runtime> IndexWriter<RT> {
756760 let mut last_logged = self . runtime . system_time ( ) ;
757761 let mut last_logged_count = 0 ;
758762 while !stream. is_done ( ) {
763+ if !INDEX_WORKER_SLEEP_TIME . is_zero ( ) {
764+ tokio:: time:: sleep ( * INDEX_WORKER_SLEEP_TIME ) . await ;
765+ }
759766 // Number of documents in the table that have been indexed in this iteration
760767 let mut num_docs_indexed = 0u64 ;
761768 let mut chunk = BTreeSet :: new ( ) ;
You can’t perform that action at this time.
0 commit comments