Collect stats on pubkeys with more than 3 events
This commit is contained in:
parent
5964a20f9e
commit
9ba3fc118d
@ -28,22 +28,26 @@ public class PubkeyStatsService : BackgroundService
|
||||
allKeys.Add(k);
|
||||
}
|
||||
|
||||
_logger.LogInformation("Collected pubkeys in: {n:#,##0}ms", sw.Elapsed.TotalMilliseconds);
|
||||
_logger.LogInformation("Collected {count:#,##0} pubkeys in: {n:#,##0}ms", allKeys.Count, sw.Elapsed.TotalMilliseconds);
|
||||
|
||||
sw.Restart();
|
||||
foreach (var pk in allKeys)
|
||||
{
|
||||
var evs = await _store.CountUserEvents(pk);
|
||||
if (evs > 3)
|
||||
{
|
||||
var stat = new PubKeyStat
|
||||
{
|
||||
PubKey = Convert.FromHexString(pk),
|
||||
LastUpdate = DateTime.UtcNow,
|
||||
TotalEvents = await _store.CountUserEvents(pk)
|
||||
TotalEvents = evs
|
||||
};
|
||||
|
||||
results.Add(stat);
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogInformation("Computed pubkey stats in: {n:#,##0}ms", sw.Elapsed.TotalMilliseconds);
|
||||
_logger.LogInformation("Computed {count:#,##0} pubkey stats in: {n:#,##0}ms", results.Count, sw.Elapsed.TotalMilliseconds);
|
||||
|
||||
await _store.StorePubkeyStats(results);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user