Reduce log spam by logging the total number of expired unconfirmed transactions that are deleted, rather than each one individually. The individual deletion logs have been moved from INFO to DEBUG.

This commit is contained in:
CalDescent 2021-06-01 20:06:37 +01:00
parent 8c305d8390
commit c443187d0b

View File

@ -883,14 +883,19 @@ public class Controller extends Thread {
List<TransactionData> transactions = repository.getTransactionRepository().getUnconfirmedTransactions(); List<TransactionData> transactions = repository.getTransactionRepository().getUnconfirmedTransactions();
int deletedCount = 0;
for (TransactionData transactionData : transactions) { for (TransactionData transactionData : transactions) {
Transaction transaction = Transaction.fromData(repository, transactionData); Transaction transaction = Transaction.fromData(repository, transactionData);
if (now >= transaction.getDeadline()) { if (now >= transaction.getDeadline()) {
LOGGER.info(() -> String.format("Deleting expired, unconfirmed transaction %s", Base58.encode(transactionData.getSignature()))); LOGGER.debug(() -> String.format("Deleting expired, unconfirmed transaction %s", Base58.encode(transactionData.getSignature())));
repository.getTransactionRepository().delete(transactionData); repository.getTransactionRepository().delete(transactionData);
deletedCount++;
} }
} }
if (deletedCount > 0) {
LOGGER.info(String.format("Deleted %d expired, unconfirmed transaction%s", deletedCount, (deletedCount == 1 ? "" : "s")));
}
repository.saveChanges(); repository.saveChanges();
} catch (DataException e) { } catch (DataException e) {