File tree Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,6 @@ const BUFFERED_BLOCK_STREAM_SIZE: usize = 100;
34
34
const BUFFERED_FIREHOSE_STREAM_SIZE : usize = 1 ;
35
35
36
36
lazy_static ! {
37
- /// Size limit of the entity LFU cache, in bytes.
38
- // Multiplied by 1000 because the env var is in KB.
39
- pub static ref ENTITY_CACHE_SIZE : usize = 1000
40
- * std:: env:: var( "GRAPH_ENTITY_CACHE_SIZE" )
41
- . unwrap_or( "10000" . into( ) )
42
- . parse:: <usize >( )
43
- . expect( "invalid GRAPH_ENTITY_CACHE_SIZE" ) ;
44
-
45
37
// Keep deterministic errors non-fatal even if the subgraph is pending.
46
38
// Used for testing Graph Node itself.
47
39
pub static ref DISABLE_FAIL_FAST : bool =
@@ -1056,20 +1048,13 @@ async fn process_block<T: RuntimeHostBuilder<C>, C: Blockchain>(
1056
1048
let ModificationsAndCache {
1057
1049
modifications : mut mods,
1058
1050
data_sources,
1059
- entity_lfu_cache : mut cache,
1051
+ entity_lfu_cache : cache,
1060
1052
} = block_state
1061
1053
. entity_cache
1062
1054
. as_modifications ( )
1063
1055
. map_err ( |e| BlockProcessingError :: Unknown ( e. into ( ) ) ) ?;
1064
1056
section. end ( ) ;
1065
1057
1066
- let section = ctx
1067
- . host_metrics
1068
- . stopwatch
1069
- . start_section ( "entity_cache_evict" ) ;
1070
- cache. evict ( * ENTITY_CACHE_SIZE ) ;
1071
- section. end ( ) ;
1072
-
1073
1058
// Put the cache back in the ctx, asserting that the placeholder cache was not used.
1074
1059
assert ! ( ctx. state. entity_lfu_cache. is_empty( ) ) ;
1075
1060
ctx. state . entity_lfu_cache = cache;
Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ lazy_static! {
37
37
) ) )
38
38
. map( Duration :: from_millis)
39
39
. unwrap_or_else( || Duration :: from_millis( 1000 ) ) ;
40
+
41
+ /// Size limit of the entity LFU cache, in bytes.
42
+ // Multiplied by 1000 because the env var is in KB.
43
+ pub static ref ENTITY_CACHE_SIZE : usize = 1000
44
+ * std:: env:: var( "GRAPH_ENTITY_CACHE_SIZE" )
45
+ . unwrap_or( "10000" . into( ) )
46
+ . parse:: <usize >( )
47
+ . expect( "invalid GRAPH_ENTITY_CACHE_SIZE" ) ;
40
48
}
41
49
42
50
/// The type name of an entity. This is the string that is used in the
@@ -1643,6 +1651,8 @@ impl EntityCache {
1643
1651
mods. push ( modification)
1644
1652
}
1645
1653
}
1654
+ self . current . evict ( * ENTITY_CACHE_SIZE ) ;
1655
+
1646
1656
Ok ( ModificationsAndCache {
1647
1657
modifications : mods,
1648
1658
data_sources : self . data_sources ,
You can’t perform that action at this time.
0 commit comments