Skip to content

Commit b64de05

Browse files
Beautify code
Signed-off-by: Valerian Saliou <valerian@valeriansaliou.name>
1 parent 0434674 commit b64de05

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/store/fst.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ impl StoreFSTPool {
133133
// certain heavy tasks, which is better to spread out consolidation steps over time over \
134134
// a large number of very active buckets.
135135

136-
// Acquire access lock, and reference it in context
137-
// Notice: access lock lets the consolidate process wait that any thread using the graph \
138-
// is done with work, while the rebuild lock prevents 2 consolidate operations to be \
136+
// Acquire rebuild + access locks, and reference them in context
137+
// Notice: access lock prevents the consolidate process from using the graph if it is \
138+
// ongoing erasure, while the rebuild lock prevents two consolidate operations to be \
139139
// executed at the same time.
140140
let (_access, _rebuild) = (
141141
GRAPH_ACCESS_LOCK.read().unwrap(),
@@ -144,6 +144,8 @@ impl StoreFSTPool {
144144

145145
let (mut count_moved, mut count_pushed, mut count_popped) = (0, 0, 0);
146146

147+
// Notice: we need to consume the lock from there rather than assign its guard to a \
148+
// variable as to avoid a deadlock when there are stores to clean.
147149
if GRAPH_CONSOLIDATE.read().unwrap().len() > 0 {
148150
// Prepare close stack (used once whole set is scanned)
149151
let mut close_stack: Vec<StoreFSTKey> = Vec::new();

0 commit comments

Comments
 (0)