mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	chore: take out grace percentage
This commit is contained in:
		
							parent
							
								
									9c045e8bfc
								
							
						
					
					
						commit
						2f584b9064
					
				@ -1,7 +1,6 @@
 | 
				
			|||||||
import type { Db } from '../../types/index.js';
 | 
					import type { Db } from '../../types/index.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TABLE = 'edge_node_presence';
 | 
					const TABLE = 'edge_node_presence';
 | 
				
			||||||
const GRACE_PERCENTAGE = 0.05;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type GetEdgeInstances = () => Promise<{
 | 
					export type GetEdgeInstances = () => Promise<{
 | 
				
			||||||
    last30: number;
 | 
					    last30: number;
 | 
				
			||||||
@ -26,16 +25,13 @@ export const createGetEdgeInstances =
 | 
				
			|||||||
            .from('buckets')
 | 
					            .from('buckets')
 | 
				
			||||||
            .select({
 | 
					            .select({
 | 
				
			||||||
                last30: db.raw(
 | 
					                last30: db.raw(
 | 
				
			||||||
                    `COALESCE(CEIL(AVG(active_nodes) FILTER (WHERE bucket_ts >= NOW() - INTERVAL '30 days') * ?)::int, 0)`,
 | 
					                    `COALESCE(CEIL(AVG(active_nodes) FILTER (WHERE bucket_ts >= NOW() - INTERVAL '30 days'))::int, 0)`,
 | 
				
			||||||
                    [1 + GRACE_PERCENTAGE],
 | 
					 | 
				
			||||||
                ),
 | 
					                ),
 | 
				
			||||||
                last60: db.raw(
 | 
					                last60: db.raw(
 | 
				
			||||||
                    `COALESCE(CEIL(AVG(active_nodes) FILTER (WHERE bucket_ts >= NOW() - INTERVAL '60 days') * ?)::int, 0)`,
 | 
					                    `COALESCE(CEIL(AVG(active_nodes) FILTER (WHERE bucket_ts >= NOW() - INTERVAL '60 days'))::int, 0)`,
 | 
				
			||||||
                    [1 + GRACE_PERCENTAGE],
 | 
					 | 
				
			||||||
                ),
 | 
					                ),
 | 
				
			||||||
                last90: db.raw(
 | 
					                last90: db.raw(
 | 
				
			||||||
                    `COALESCE(CEIL(AVG(active_nodes) FILTER (WHERE bucket_ts >= NOW() - INTERVAL '90 days') * ?)::int, 0)`,
 | 
					                    `COALESCE(CEIL(AVG(active_nodes) FILTER (WHERE bucket_ts >= NOW() - INTERVAL '90 days'))::int, 0)`,
 | 
				
			||||||
                    [1 + GRACE_PERCENTAGE],
 | 
					 | 
				
			||||||
                ),
 | 
					                ),
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
            .first();
 | 
					            .first();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user