data rework

This commit is contained in:
Ben Wilson
2023-08-01 22:39:02 -04:00
parent d718df88cd
commit 5dd1fa3dfa
7 changed files with 140 additions and 124 deletions
+7 -2
View File
@@ -24,9 +24,14 @@ export class StratumV1ClientStatistics {
difficulty: targetDifficulty,
});
// 10 min
var coeff = 1000 * 60 * 10;
var date = new Date();
var rounded = new Date(Math.round(date.getTime() / coeff) * coeff);
await this.clientStatisticsService.save({
time: new Date(),
difficulty: targetDifficulty,
time: rounded.getTime(),
shares: targetDifficulty,
address: client.address,
clientName: client.clientName,
sessionId: client.sessionId,
@@ -14,7 +14,7 @@ export class SubscriptionMessage extends StratumBaseMessage {
@IsString()
@MaxLength(128)
@Transform(({ value, key, obj, type }) => {
return obj.params[0] == null ? 'unknown' : SubscriptionMessage.refineUserAgent(obj.params);
return obj.params[0] == null ? 'unknown' : SubscriptionMessage.refineUserAgent(obj.params[0]);
})
public userAgent: string;