mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +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[]> {
|
async getAllActive(): Promise<IApiToken[]> {
|
||||||
const stopTimer = this.timer('getAllActive');
|
const stopTimer = this.timer('getAllActive');
|
||||||
const rows = await this.db<ITokenTable>(TABLE)
|
const rows = await this.db<ITokenTable>(TABLE)
|
||||||
.where('expires_at', '>', new Date())
|
.where('expires_at', 'IS', null)
|
||||||
.orWhere('expires_at', 'IS', null);
|
.orWhere('expires_at', '>', 'now()');
|
||||||
stopTimer();
|
stopTimer();
|
||||||
return rows.map(toToken);
|
return rows.map(toToken);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user