mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: improve performance for fetching active api tokens
This commit is contained in:
		
							parent
							
								
									c3bd2acda3
								
							
						
					
					
						commit
						c518ddf84c
					
				@ -65,8 +65,8 @@ export class ApiTokenStore implements IApiTokenStore {
 | 
			
		||||
    async getAllActive(): Promise<IApiToken[]> {
 | 
			
		||||
        const stopTimer = this.timer('getAllActive');
 | 
			
		||||
        const rows = await this.db<ITokenTable>(TABLE)
 | 
			
		||||
            .where('expires_at', '>', new Date())
 | 
			
		||||
            .orWhere('expires_at', 'IS', null);
 | 
			
		||||
            .where('expires_at', 'IS', null)
 | 
			
		||||
            .orWhere('expires_at', '>', 'now()');
 | 
			
		||||
        stopTimer();
 | 
			
		||||
        return rows.map(toToken);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user