commit d85e910262df4cf0c29a4620102d1fb51850c290
parent 7f61f22857e54954dfe1132ceb91f8006e055a57
Author: SomberNight <somber.night@protonmail.com>
Date: Sat, 27 Feb 2021 12:27:26 +0100
logging: eliminate "fee_estimates" log spam
only log fee estimates if they changed, instead of ~10 times per minute
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/electrum/network.py b/electrum/network.py
@@ -36,6 +36,7 @@ from typing import NamedTuple, Optional, Sequence, List, Dict, Tuple, TYPE_CHECK
import traceback
import concurrent
from concurrent import futures
+import copy
import aiorpcx
from aiorpcx import TaskGroup
@@ -531,7 +532,9 @@ class Network(Logger, NetworkRetryManager[ServerAddr]):
e = self.get_fee_estimates()
for nblock_target, fee in e.items():
self.config.update_fee_estimates(nblock_target, fee)
- self.logger.info(f'fee_estimates {e}')
+ if not hasattr(self, "_prev_fee_est") or self._prev_fee_est != e:
+ self._prev_fee_est = copy.copy(e)
+ self.logger.info(f'fee_estimates {e}')
self.notify('fee')
@with_recent_servers_lock