UBERF-7865: Final fix (#6316)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-08-12 15:14:12 +07:00 committed by GitHub
parent de06891111
commit 319ce9cafc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View File

@ -579,14 +579,24 @@ function getExtra (info: Account | AccountInfo | null, rec?: Record<string, any>
export const guestAccountEmail = '#guest@hc.engineering'
const failedEmails = new Set()
function decodeToken (ctx: MeasureContext, token: string): Token {
// eslint-disable-next-line no-useless-catch
try {
return decodeTokenRaw(token)
} catch (err: any) {
try {
// Ok we have error, but we need to log a proper message
ctx.warn('failed to verify token', { ...decodeTokenRaw(token, false) })
const decode = decodeTokenRaw(token, false)
const has = failedEmails.has(decode.email)
if (!has) {
failedEmails.add(decode.email)
// Ok we have error, but we need to log a proper message
ctx.warn('failed to verify token', { ...decode })
}
if (failedEmails.size > 1000) {
failedEmails.clear()
}
} catch (err2: any) {
// Ignore
}

View File

@ -89,6 +89,9 @@ export class DomainIndexHelperImpl implements DomainHelper {
const added = new Set<string>()
try {
if (!operations.exists(domain)) {
return
}
const has50Documents = documents > 50
const allIndexes = (await operations.listIndexes(domain)).filter((it) => it.name !== '_id_')
ctx.info('check indexes', { domain, has50Documents, documents })