mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-01-30 18:39:50 +08:00
impr(backend): consider incomplete tests when checking result spacing
!nuf
This commit is contained in:
parent
7ed56db4e0
commit
73f8022992
1 changed files with 5 additions and 1 deletions
|
@ -276,6 +276,8 @@ export async function addResult(
|
|||
) {
|
||||
const status = MonkeyStatusCodes.RESULT_DATA_INVALID;
|
||||
throw new MonkeyError(status.code, "Result data doesn't make sense");
|
||||
} else if (isDevEnvironment()) {
|
||||
Logger.success("Result data validated");
|
||||
}
|
||||
} else {
|
||||
if (!isDevEnvironment()) {
|
||||
|
@ -311,7 +313,9 @@ export async function addResult(
|
|||
|
||||
//check if now is earlier than last result plus duration (-1 second as a buffer)
|
||||
const testDurationMilis = completedEvent.testDuration * 1000;
|
||||
const earliestPossible = (lastResultTimestamp ?? 0) + testDurationMilis;
|
||||
const incompleteTestsMilis = completedEvent.incompleteTestSeconds * 1000;
|
||||
const earliestPossible =
|
||||
(lastResultTimestamp ?? 0) + testDurationMilis + incompleteTestsMilis;
|
||||
const nowNoMilis = Math.floor(Date.now() / 1000) * 1000;
|
||||
if (lastResultTimestamp && nowNoMilis < earliestPossible - 1000) {
|
||||
void addLog(
|
||||
|
|
Loading…
Reference in a new issue