Skip to content

Commit 45d8ecd

Browse files
authored
less needy debug info (#19954)
1 parent 8539ae8 commit 45d8ecd

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

chia/full_node/coin_store.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,21 @@ async def new_block(
154154
await self._set_spent(tx_removals, height)
155155

156156
end = time.monotonic()
157-
log.log(
158-
logging.WARNING if end - start > 10 else logging.DEBUG,
157+
took_too_long = end - start > 10
158+
159+
message = (
159160
f"Height {height}: It took {end - start:0.2f}s to apply {len(tx_additions)} additions and "
160-
+ f"{len(tx_removals)} removals to the coin store. Make sure "
161-
+ "blockchain database is on a fast drive",
161+
+ f"{len(tx_removals)} removals to the coin store."
162162
)
163163

164+
if took_too_long:
165+
level = logging.WARNING
166+
message += " Make sure blockchain database is on a fast drive"
167+
else:
168+
level = logging.DEBUG
169+
170+
log.log(level, message)
171+
164172
# Checks DB and DiffStores for CoinRecord with coin_name and returns it
165173
async def get_coin_record(self, coin_name: bytes32) -> Optional[CoinRecord]:
166174
async with self.db_wrapper.reader_no_transaction() as conn:

0 commit comments

Comments
 (0)