Skip to content

Commit 56963b2

Browse files
committed
server: Remove unnecessary timing logs
1 parent 2e45d79 commit 56963b2

5 files changed

+1
-38
lines changed

server/app/com/xsn/explorer/data/anorm/LedgerPostgresDataHandler.scala

+1-13
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class LedgerPostgresDataHandler @Inject() (
3434
block: Block,
3535
transactions: List[Transaction]): ApplicationResult[Unit] = {
3636

37-
val start = System.currentTimeMillis()
3837
val result = withTransaction { implicit conn =>
3938
val result = for {
4039
_ <- upsertBlockCascade(block.copy(nextBlockhash = None), transactions)
@@ -51,8 +50,6 @@ class LedgerPostgresDataHandler @Inject() (
5150
case _ => e
5251
}
5352

54-
val took = System.currentTimeMillis() - start
55-
logger.info(s"Pushing block = ${block.hash}, took $took ms")
5653
result.badMap { _.map(fromError) }
5754
}
5855

@@ -119,13 +116,7 @@ class LedgerPostgresDataHandler @Inject() (
119116
}
120117

121118
private def insertBalanceBatch(balanceList: Iterable[Balance])(implicit conn: Connection) = {
122-
val start = System.currentTimeMillis()
123-
val result = balanceList.map { b => balancePostgresDAO.upsert(b) }
124-
125-
val took = System.currentTimeMillis() - start
126-
logger.info(s"Inserting balance batch, size = ${balanceList.size}, took = $took ms")
127-
128-
result
119+
balanceList.map { b => balancePostgresDAO.upsert(b) }
129120
}
130121

131122
private def spendMap(transactions: List[Transaction]): Map[Address, BigDecimal] = {
@@ -151,7 +142,6 @@ class LedgerPostgresDataHandler @Inject() (
151142
}
152143

153144
private def balances(transactions: List[Transaction]) = {
154-
val start = System.currentTimeMillis()
155145
val spentList = spendMap(transactions).map { case (address, spent) =>
156146
Balance(address, spent = spent)
157147
}
@@ -165,8 +155,6 @@ class LedgerPostgresDataHandler @Inject() (
165155
.mapValues { _.reduce(mergeBalances) }
166156
.values
167157

168-
val took = System.currentTimeMillis() - start
169-
logger.info(s"Computing balances for transaction batch, size = ${transactions.size}, took = $took ms")
170158
result
171159
}
172160

server/app/com/xsn/explorer/data/anorm/dao/TransactionInputPostgresDAO.scala

-6
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ class TransactionInputPostgresDAO {
1919
case Nil => Some(inputs)
2020

2121
case _ =>
22-
23-
val start = System.currentTimeMillis()
2422
val params = inputs.map { case (txid, input) =>
2523
List(
2624
'txid -> txid.string: NamedParameter,
@@ -43,10 +41,6 @@ class TransactionInputPostgresDAO {
4341
)
4442

4543
val success = batch.execute().forall(_ == 1)
46-
47-
val took = System.currentTimeMillis() - start
48-
logger.info(s"Inserting input batch, size = ${inputs.size}, took = $took ms")
49-
5044
if (success) {
5145
Some(inputs)
5246
} else {

server/app/com/xsn/explorer/data/anorm/dao/TransactionOutputPostgresDAO.scala

-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class TransactionOutputPostgresDAO {
3232
outputs match {
3333
case Nil => Some(outputs)
3434
case _ =>
35-
val start = System.currentTimeMillis()
3635
val params = outputs.map { output =>
3736
List(
3837
'txid -> output.txid.string: NamedParameter,
@@ -56,9 +55,6 @@ class TransactionOutputPostgresDAO {
5655
)
5756

5857
val success = batch.execute().forall(_ == 1)
59-
60-
val took = System.currentTimeMillis() - start
61-
logger.info(s"Inserting output batch, size = ${outputs.size}, took = $took ms")
6258
if (success) {
6359
Some(outputs)
6460
} else {

server/app/com/xsn/explorer/data/anorm/dao/TransactionPostgresDAO.scala

-12
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,13 @@ class TransactionPostgresDAO @Inject() (
5050
}
5151

5252
private def insertDetails(transactions: List[Transaction])(implicit conn: Connection): Unit = {
53-
val start = System.currentTimeMillis()
5453
val detailsResult = transactions.map(addressTransactionDetailsDAO.batchInsertDetails)
55-
val took = System.currentTimeMillis() - start
56-
57-
logger.info(s"Inserting address details batch, size = ${transactions.size}, took = $took ms")
5854

5955
assert(detailsResult.forall(_.isDefined), "Inserting address details batch failed")
6056
}
6157

6258
private def spend(transactions: List[Transaction])(implicit conn: Connection): Unit = {
63-
val start = System.currentTimeMillis()
6459
val spendResult = transactions.map { tx => transactionOutputDAO.batchSpend(tx.id, tx.inputs) }
65-
val took = System.currentTimeMillis() - start
66-
67-
logger.info(s"Spending transaction batch, size = ${transactions.size}, took = $took ms")
6860

6961
assert(spendResult.forall(_.isDefined), "Spending inputs batch failed")
7062
}
@@ -73,7 +65,6 @@ class TransactionPostgresDAO @Inject() (
7365
transactions match {
7466
case Nil => Some(transactions)
7567
case _ =>
76-
val start = System.currentTimeMillis()
7768
val params = transactions.zipWithIndex.map { case (transaction, index) =>
7869
List(
7970
'txid -> transaction.id.string: NamedParameter,
@@ -95,9 +86,6 @@ class TransactionPostgresDAO @Inject() (
9586
)
9687

9788
val success = batch.execute().forall(_ == 1)
98-
99-
val took = System.currentTimeMillis() - start
100-
logger.info(s"Inserting transaction batch, size = ${transactions.size}, took = $took ms")
10189
if (success) {
10290
Some(transactions)
10391
} else {

server/app/com/xsn/explorer/services/LedgerSynchronizerService.scala

-3
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,9 @@ class LedgerSynchronizerService @Inject() (
158158
}
159159

160160
private def getRPCBlock(blockhash: Blockhash): FutureApplicationResult[(Block, List[Transaction])] = {
161-
val start = System.currentTimeMillis()
162161
val result = for {
163162
block <- xsnService.getBlock(blockhash).toFutureOr
164163
transactions <- transactionRPCService.getTransactions(block.transactions).toFutureOr
165-
took = System.currentTimeMillis() - start
166-
_ = logger.info(s"Retrieving block = $blockhash, took $took ms")
167164
} yield (block, transactions)
168165

169166
result.toFuture

0 commit comments

Comments
 (0)