@@ -56,14 +56,14 @@ pub fn start_inscription_indexing_processor(
56
56
let ctx = ctx. clone ( ) ;
57
57
let handle: JoinHandle < ( ) > = hiro_system_kit:: thread_named ( "Inscription indexing runloop" )
58
58
. spawn ( move || {
59
- let cache_l2 = Arc :: new ( new_traversals_lazy_cache ( 1024 ) ) ;
60
- let garbage_collect_every_n_blocks = 100 ;
59
+ let cache_l2 = Arc :: new ( new_traversals_lazy_cache ( 100_000 ) ) ;
60
+ let garbage_collect_every_n_blocks = 256 ;
61
61
let mut garbage_collect_nth_block = 0 ;
62
62
63
63
let mut inscriptions_db_conn_rw =
64
64
open_readwrite_ordhook_db_conn ( & config. expected_cache_path ( ) , & ctx) . unwrap ( ) ;
65
65
let ordhook_config = config. get_ordhook_config ( ) ;
66
- let blocks_db_rw =
66
+ let mut blocks_db_rw =
67
67
open_readwrite_ordhook_db_conn_rocks_db ( & config. expected_cache_path ( ) , & ctx) . unwrap ( ) ;
68
68
let mut empty_cycles = 0 ;
69
69
@@ -132,14 +132,23 @@ pub fn start_inscription_indexing_processor(
132
132
133
133
garbage_collect_nth_block += blocks. len ( ) ;
134
134
135
- // Clear L2 cache on a regular basis
136
135
if garbage_collect_nth_block > garbage_collect_every_n_blocks {
136
+ // Clear L2 cache on a regular basis
137
137
info ! (
138
138
ctx. expect_logger( ) ,
139
139
"Clearing cache L2 ({} entries)" ,
140
140
cache_l2. len( )
141
141
) ;
142
142
cache_l2. clear ( ) ;
143
+
144
+ // Clear rocksdb db connection on a regular basis
145
+ let _ = blocks_db_rw. flush_wal ( true ) ;
146
+ blocks_db_rw = open_readwrite_ordhook_db_conn_rocks_db ( & config. expected_cache_path ( ) , & ctx) . unwrap ( ) ;
147
+
148
+ // Recreate sqlite db connection on a regular basis
149
+ inscriptions_db_conn_rw =
150
+ open_readwrite_ordhook_db_conn ( & config. expected_cache_path ( ) , & ctx) . unwrap ( ) ;
151
+
143
152
garbage_collect_nth_block = 0 ;
144
153
}
145
154
}
0 commit comments