Fix more .unwrap()'s
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
Alex 2022-06-06 16:37:44 +02:00
parent bbf68aa039
commit c3c8d59c99
Signed by: lx
GPG Key ID: 0E496D15096376BE
3 changed files with 28 additions and 13 deletions

View File

@ -28,7 +28,9 @@ impl BlockManagerMetrics {
Self {
_resync_queue_len: meter
.u64_value_observer("block.resync_queue_length", move |observer| {
observer.observe(resync_queue.len().unwrap() as u64, &[]) // TODO fix unwrap
if let Ok(v) = resync_queue.len() {
observer.observe(v as u64, &[]);
}
})
.with_description(
"Number of block hashes queued for local check and possible resync",
@ -36,7 +38,9 @@ impl BlockManagerMetrics {
.init(),
_resync_errored_blocks: meter
.u64_value_observer("block.resync_errored_blocks", move |observer| {
observer.observe(resync_errors.len().unwrap() as u64, &[]) // TODO fix unwrap
if let Ok(v) = resync_errors.len() {
observer.observe(v as u64, &[]);
}
})
.with_description("Number of block hashes whose last resync resulted in an error")
.init(),

View File

@ -26,10 +26,12 @@ impl TableMetrics {
.u64_value_observer(
"table.merkle_updater_todo_queue_length",
move |observer| {
observer.observe(
merkle_todo.len().unwrap() as u64, // TODO fix unwrap
&[KeyValue::new("table_name", table_name)],
)
if let Ok(v) = merkle_todo.len() {
observer.observe(
v as u64,
&[KeyValue::new("table_name", table_name)],
);
}
},
)
.with_description("Merkle tree updater TODO queue length")
@ -38,10 +40,12 @@ impl TableMetrics {
.u64_value_observer(
"table.gc_todo_queue_length",
move |observer| {
observer.observe(
gc_todo.len().unwrap() as u64, // TODO fix unwrap
&[KeyValue::new("table_name", table_name)],
)
if let Ok(v) = gc_todo.len() {
observer.observe(
v as u64,
&[KeyValue::new("table_name", table_name)],
);
}
},
)
.with_description("Table garbage collector TODO queue length")

View File

@ -603,9 +603,16 @@ impl SyncTodo {
let retain = nodes.contains(&my_id);
if !retain {
// Check if we have some data to send, otherwise skip
if data.store.range(begin..end).unwrap().next().is_none() {
// TODO fix unwrap
continue;
match data.store.range(begin..end) {
Ok(mut iter) => {
if iter.next().is_none() {
continue;
}
}
Err(e) => {
warn!("DB error in add_full_sync: {}", e);
continue;
}
}
}