UBERF-7865: Fix wrong access to not created collection (#6315)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-08-11 18:31:56 +07:00 committed by GitHub
parent e4ed3bd8af
commit d9640ccaa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 3 deletions

View File

@ -62,6 +62,8 @@ services:
- LAST_NAME_FIRST=true - LAST_NAME_FIRST=true
- ACCOUNTS_URL=http://localhost:3000 - ACCOUNTS_URL=http://localhost:3000
- BRANDING_PATH=/var/cfg/branding.json - BRANDING_PATH=/var/cfg/branding.json
- INIT_SCRIPT_URL=https://raw.githubusercontent.com/hcengineering/init/main/script.yaml
- INIT_WORKSPACE=onboarding
restart: unless-stopped restart: unless-stopped
collaborator: collaborator:
image: hardcoreeng/collaborator image: hardcoreeng/collaborator

View File

@ -16,7 +16,7 @@ const disabled = (process.env.MODEL_DISABLED ?? '').split(',').map((it) => it.tr
const txes = JSON.parse(JSON.stringify(builder(enabled, disabled).getTxes())) as Tx[] const txes = JSON.parse(JSON.stringify(builder(enabled, disabled).getTxes())) as Tx[]
configureAnalytics(process.env.SENTRY_DSN, {}) configureAnalytics(process.env.SENTRY_DSN, {})
Analytics.setTag('application', 'transactor') Analytics.setTag('application', 'account')
const metricsContext = new MeasureMetricsContext( const metricsContext = new MeasureMetricsContext(
'account', 'account',

View File

@ -174,6 +174,7 @@ export class DomainIndexHelperImpl implements DomainHelper {
} }
} }
} catch (err: any) { } catch (err: any) {
ctx.error('error during domain collections/indexes check', { domain, error: err })
Analytics.handleError(err) Analytics.handleError(err)
} }

View File

@ -230,7 +230,10 @@ export class DBCollectionHelper implements DomainHelperOperations {
} }
async estimatedCount (domain: Domain): Promise<number> { async estimatedCount (domain: Domain): Promise<number> {
const c = this.collection(domain) if (this.exists(domain)) {
return await c.estimatedDocumentCount() const c = this.collection(domain)
return await c.estimatedDocumentCount()
}
return 0
} }
} }