mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +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 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]);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user