minimum diff 1

This commit is contained in:
Ben Wilson
2023-06-28 07:30:46 -04:00
parent 6b0520e73f
commit e230e25e91
2 changed files with 9 additions and 5 deletions
@@ -63,7 +63,7 @@ export class ClientStatisticsService {
WHERE WHERE
entry.address = ? AND entry.time > datetime("now", "-1 day") entry.address = ? AND entry.time > datetime("now", "-1 day")
GROUP BY GROUP BY
strftime('%Y-%m-%d %H', time, 'localtime') || (strftime('%M', time, 'localtime') / 5) strftime('%Y-%m-%d %H', time, 'localtime') || (strftime('%M', time, 'localtime') / 10)
ORDER BY ORDER BY
time time
) )
@@ -111,7 +111,7 @@ export class ClientStatisticsService {
WHERE WHERE
entry.address = ? AND entry.clientName = ? AND entry.time > datetime("now", "-1 day") entry.address = ? AND entry.clientName = ? AND entry.time > datetime("now", "-1 day")
GROUP BY GROUP BY
strftime('%Y-%m-%d %H', time, 'localtime') || (strftime('%M', time, 'localtime') / 5) strftime('%Y-%m-%d %H', time, 'localtime') || (strftime('%M', time, 'localtime') / 10)
ORDER BY ORDER BY
time time
) )
@@ -160,7 +160,7 @@ export class ClientStatisticsService {
WHERE WHERE
entry.address = ? AND entry.clientName = ? AND entry.sessionId = ? AND entry.time > datetime("now", "-1 day") entry.address = ? AND entry.clientName = ? AND entry.sessionId = ? AND entry.time > datetime("now", "-1 day")
GROUP BY GROUP BY
strftime('%Y-%m-%d %H', time, 'localtime') || (strftime('%M', time, 'localtime') / 5) strftime('%Y-%m-%d %H', time, 'localtime') || (strftime('%M', time, 'localtime') / 10)
ORDER BY ORDER BY
time time
) )
+6 -2
View File
@@ -2,7 +2,7 @@ import { ClientStatisticsService } from '../ORM/client-statistics/client-statist
import { ClientEntity } from '../ORM/client/client.entity'; import { ClientEntity } from '../ORM/client/client.entity';
const CACHE_SIZE = 30; const CACHE_SIZE = 30;
const TARGET_SUBMISSION_PER_SECOND = 30; const TARGET_SUBMISSION_PER_SECOND = 10;
export class StratumV1ClientStatistics { export class StratumV1ClientStatistics {
private submissionCacheStart: Date; private submissionCacheStart: Date;
@@ -70,7 +70,11 @@ export class StratumV1ClientStatistics {
x = x | (x >> 8); x = x | (x >> 8);
x = x | (x >> 16); x = x | (x >> 16);
x = x | (x >> 32); x = x | (x >> 32);
return x - (x >> 1); const val = x - (x >> 1);
if (val < 1) {
return 1;
}
return val;
} }