Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(identity-access-token): set random_page_cost in removeExpiredRevocations
Claudeb5306ef1d272
diff --git a/backend/src/services/identity-access-token/identity-access-token-revocation-dal.ts b/backend/src/services/identity-access-token/identity-access-token-revocation-dal.tsindex 9f18018635..41921915ca 100644--- a/backend/src/services/identity-access-token/identity-access-token-revocation-dal.ts+++ b/backend/src/services/identity-access-token/identity-access-token-revocation-dal.ts@@ -95,6 +95,11 @@ export const identityAccessTokenRevocationDALFactory = (db: TDbClient) => {deletedRevocationIds = await db.transaction(async (trx) => {await trx.raw(`SET LOCAL statement_timeout = ${QUERY_TIMEOUT_MS}`);+ // The default random_page_cost is 4.0, which is too high for this query.+ // With SSD powered database, random access is way faster.+ // We set it to 1.1 to make the query opt for random access and thus more likely to use the index.+ await trx.raw(`SET LOCAL random_page_cost = 1.1`);+const findExpiredRevocationsSubQuery = trx(TableName.IdentityAccessTokenRevocation).where("expiresAt", "<", db.fn.now()).select("id")