1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: use utc to compare time (#3038)

## About the changes
We've found that 60000 was just 1 minute and we wanted it to be 10
minutes so we were missing 1 zero and sometimes in 1 minute we didn't
have data. This is still an assumption we'll verify in sandbox

Co-authored-by: Nuno Góis <github@nunogois.com>
This commit is contained in:
Gastón Fournier 2023-02-02 18:34:36 +01:00 committed by GitHub
parent a0e4f54b9a
commit 5d382d3442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ const StyledMermaid = styled(Mermaid)(({ theme }) => ({
}));
const isRecent = (value: ResultValue) => {
const threshold = 60000; // ten minutes
const threshold = 600000; // ten minutes
return value[0] * 1000 > new Date().getTime() - threshold;
};
@ -36,6 +36,7 @@ const toGraphData = (metrics?: RequestsPerSecondSchema) => {
?.map(result => {
const values = (result.values || []) as ResultValue[];
const data = values.filter(value => isRecent(value)) || [];
console.log('data', data);
let reqs = 0;
if (data.length) {
reqs = parseFloat(data[data.length - 1][1]);