mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-05 23:12:42 +00:00
UBERF-7865: Final fix (#6316)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
28abb65d31
commit
beccd6f148
@ -579,14 +579,24 @@ function getExtra (info: Account | AccountInfo | null, rec?: Record<string, any>
|
|||||||
|
|
||||||
export const guestAccountEmail = '#guest@hc.engineering'
|
export const guestAccountEmail = '#guest@hc.engineering'
|
||||||
|
|
||||||
|
const failedEmails = new Set()
|
||||||
|
|
||||||
function decodeToken (ctx: MeasureContext, token: string): Token {
|
function decodeToken (ctx: MeasureContext, token: string): Token {
|
||||||
// eslint-disable-next-line no-useless-catch
|
// eslint-disable-next-line no-useless-catch
|
||||||
try {
|
try {
|
||||||
return decodeTokenRaw(token)
|
return decodeTokenRaw(token)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
try {
|
try {
|
||||||
|
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
|
// Ok we have error, but we need to log a proper message
|
||||||
ctx.warn('failed to verify token', { ...decodeTokenRaw(token, false) })
|
ctx.warn('failed to verify token', { ...decode })
|
||||||
|
}
|
||||||
|
if (failedEmails.size > 1000) {
|
||||||
|
failedEmails.clear()
|
||||||
|
}
|
||||||
} catch (err2: any) {
|
} catch (err2: any) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,9 @@ export class DomainIndexHelperImpl implements DomainHelper {
|
|||||||
const added = new Set<string>()
|
const added = new Set<string>()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (!operations.exists(domain)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const has50Documents = documents > 50
|
const has50Documents = documents > 50
|
||||||
const allIndexes = (await operations.listIndexes(domain)).filter((it) => it.name !== '_id_')
|
const allIndexes = (await operations.listIndexes(domain)).filter((it) => it.name !== '_id_')
|
||||||
ctx.info('check indexes', { domain, has50Documents, documents })
|
ctx.info('check indexes', { domain, has50Documents, documents })
|
||||||
|
Loading…
Reference in New Issue
Block a user