Remove reliance on a blockchain read lock from block/commit

This commit is contained in:
Luke Parker
2023-04-23 23:37:40 -04:00
parent c476f9b640
commit 215155f84b
6 changed files with 31 additions and 32 deletions

View File

@@ -175,8 +175,8 @@ pub async fn heartbeat_tributaries<D: Db, P: P2p>(
for ActiveTributary { spec: _, tributary } in tributaries.read().await.values() {
let tributary = tributary.read().await;
let tip = tributary.tip().await;
let block_time = SystemTime::UNIX_EPOCH +
Duration::from_secs(tributary.time_of_block(&tip).await.unwrap_or(0));
let block_time =
SystemTime::UNIX_EPOCH + Duration::from_secs(tributary.time_of_block(&tip).unwrap_or(0));
// Only trigger syncing if the block is more than a minute behind
if SystemTime::now() > (block_time + Duration::from_secs(60)) {