mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +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:
parent
a0e4f54b9a
commit
5d382d3442
@ -17,7 +17,7 @@ const StyledMermaid = styled(Mermaid)(({ theme }) => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const isRecent = (value: ResultValue) => {
|
const isRecent = (value: ResultValue) => {
|
||||||
const threshold = 60000; // ten minutes
|
const threshold = 600000; // ten minutes
|
||||||
return value[0] * 1000 > new Date().getTime() - threshold;
|
return value[0] * 1000 > new Date().getTime() - threshold;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -36,6 +36,7 @@ const toGraphData = (metrics?: RequestsPerSecondSchema) => {
|
|||||||
?.map(result => {
|
?.map(result => {
|
||||||
const values = (result.values || []) as ResultValue[];
|
const values = (result.values || []) as ResultValue[];
|
||||||
const data = values.filter(value => isRecent(value)) || [];
|
const data = values.filter(value => isRecent(value)) || [];
|
||||||
|
console.log('data', data);
|
||||||
let reqs = 0;
|
let reqs = 0;
|
||||||
if (data.length) {
|
if (data.length) {
|
||||||
reqs = parseFloat(data[data.length - 1][1]);
|
reqs = parseFloat(data[data.length - 1][1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user