From 3af1d82aaad0ae0e4b7b18bac858019afacd1f74 Mon Sep 17 00:00:00 2001 From: Garrett Stevens Date: Tue, 2 Jul 2024 23:35:30 +0000 Subject: [PATCH] Remove excess logging from adding features --- packages/apollo-common/src/AssemblySpecificChange.ts | 9 +-------- .../src/Changes/AddFeaturesFromFileChange.ts | 6 +++++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/apollo-common/src/AssemblySpecificChange.ts b/packages/apollo-common/src/AssemblySpecificChange.ts index f93f3aeb..70284d11 100644 --- a/packages/apollo-common/src/AssemblySpecificChange.ts +++ b/packages/apollo-common/src/AssemblySpecificChange.ts @@ -227,23 +227,16 @@ export abstract class AssemblySpecificChange extends Change { const featureIds: string[] = [] const newFeature = createFeature(gff3Feature, refSeqDoc._id, featureIds) - logger.debug?.(`So far feature ids are: ${featureIds.toString()}`) // Add value to gffId newFeature.attributes?._id ? (newFeature.gffId = newFeature.attributes?._id.toString()) : (newFeature.gffId = newFeature._id) - logger.debug?.( - `********************* Assembly specific change create ${JSON.stringify( - newFeature, - )}`, - ) // Add into Mongo // We cannot use Mongo 'session' / transaction here because Mongo has 16 MB limit for transaction - const [newFeatureDoc] = await featureModel.create([ + await featureModel.create([ { allIds: featureIds, ...newFeature, user, status: -1 }, ]) - logger.verbose?.(`Added docId "${newFeatureDoc._id}"`) } } diff --git a/packages/apollo-shared/src/Changes/AddFeaturesFromFileChange.ts b/packages/apollo-shared/src/Changes/AddFeaturesFromFileChange.ts index 9df38fc9..392ba607 100644 --- a/packages/apollo-shared/src/Changes/AddFeaturesFromFileChange.ts +++ b/packages/apollo-shared/src/Changes/AddFeaturesFromFileChange.ts @@ -91,13 +91,17 @@ export class AddFeaturesFromFileChange extends AssemblySpecificChange { const featureStream = filesService.parseGFF3( filesService.getFileStream(fileDoc), ) + let featureCount = 0 for await (const f of featureStream) { const gff3Feature = f as GFF3Feature - logger.verbose?.(`ENTRY=${JSON.stringify(gff3Feature)}`) // Add new feature into database // We cannot use Mongo 'session' / transaction here because Mongo has 16 MB limit for transaction await this.addFeatureIntoDb(gff3Feature, backend) + featureCount++ + if (featureCount % 1000 === 0) { + logger.debug?.(`Processed ${featureCount} features`) + } } } logger.debug?.('New features added into database!')