Skip to content

Commit

Permalink
round upload durations to nearest ms
Browse files Browse the repository at this point in the history
  • Loading branch information
cacieprins committed Nov 28, 2023
1 parent ee407af commit 1ded84a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/server/lib/modes/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
url: artifact.uploadUrl,
fileSize: artifact.fileSize,
key: artifact.reportKey,
uploadDuration: performance.now() - startTime,
// performance.now() gives milliseconds with many decimals - this is
// higher resolution than we need, and the cy cloud column is int, not
// a floating poina
uploadDuration: Math.round(performance.now() - startTime),
}
}

Expand All @@ -289,7 +292,7 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
pathToFile: artifact.filePath,
fileSize: artifact.fileSize,
key: artifact.reportKey,
uploadDuration: performance.now() - startTime,
uploadDuration: Math.round(performance.now() - startTime),
}
} catch (err) {
debug('failed to upload artifact %o', {
Expand All @@ -308,7 +311,7 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
allErrors: err.errors,
url: artifact.uploadUrl,
pathToFile: artifact.filePath,
uploadDuration: performance.now() - startTime,
uploadDuration: Math.round(performance.now() - startTime),
}
}

Expand All @@ -318,7 +321,7 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
error: err.message,
url: artifact.uploadUrl,
pathToFile: artifact.filePath,
uploadDuration: performance.now() - startTime,
uploadDuration: Math.round(performance.now() - startTime),
}
}
}),
Expand Down

0 comments on commit 1ded84a

Please sign in to comment.