Skip to content

Commit

Permalink
fix: use utc to compare time (#3038)
Browse files Browse the repository at this point in the history
## 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>
  • Loading branch information
Gastón Fournier and nunogois committed Feb 2, 2023
1 parent a0e4f54 commit 5d382d3
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -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;
};

Expand All @@ -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]);
Expand Down

0 comments on commit 5d382d3

Please sign in to comment.