1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00

fix: improve performance for fetching active api tokens

This commit is contained in:
Ivar Conradi Østhus 2021-09-02 10:05:31 +02:00
parent c3bd2acda3
commit c518ddf84c

View File

@ -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);
}