|
6 | 6 | using System.Collections.Generic; |
7 | 7 | using System.Diagnostics; |
8 | 8 | using System.Diagnostics.CodeAnalysis; |
| 9 | +using System.Text.Json; |
9 | 10 | using System.Threading; |
10 | 11 | using System.Threading.Channels; |
11 | 12 | using System.Threading.Tasks; |
@@ -81,6 +82,8 @@ public ProcessingQueue( |
81 | 82 |
|
82 | 83 | public string Description => "log index service"; |
83 | 84 |
|
| 85 | + private long _startTimestamp = Stopwatch.GetTimestamp(); // TODO: remove after testing |
| 86 | + |
84 | 87 | public LogIndexService(ILogIndexStorage logIndexStorage, ILogIndexConfig config, |
85 | 88 | IBlockTree blockTree, ISyncConfig syncConfig, |
86 | 89 | IReceiptFinder receiptFinder, IReceiptStorage receiptStorage, |
@@ -133,6 +136,7 @@ public async Task StartAsync() |
133 | 136 | _logger.Info($"{GetLogPrefix()}: waiting for the first block..."); |
134 | 137 |
|
135 | 138 | await _pivotTask; |
| 139 | + _startTimestamp = Stopwatch.GetTimestamp(); |
136 | 140 |
|
137 | 141 | StartProcessing(isForward: true); |
138 | 142 | StartProcessing(isForward: false); |
@@ -449,7 +453,13 @@ private void MarkCompleted(bool isForward) |
449 | 453 | progress.MarkEnd(); |
450 | 454 |
|
451 | 455 | if (_logger.IsInfo) |
452 | | - _logger.Info($"{GetLogPrefix(isForward)}: completed."); |
| 456 | + { |
| 457 | + var elapsed = Stopwatch.GetElapsedTime(_startTimestamp); |
| 458 | + var config = JsonSerializer.Serialize(_config, JsonSerializerOptions.Default); |
| 459 | + var dbSize = _logIndexStorage.GetDbSize(); |
| 460 | + |
| 461 | + _logger.Info($"{GetLogPrefix(isForward)}: completed in {elapsed} with DB size of {dbSize} using config {config}."); |
| 462 | + } |
453 | 463 | } |
454 | 464 |
|
455 | 465 | private static int? GetNextBlockNumber(ILogIndexStorage storage, bool isForward) |
|
0 commit comments