Commented get tags in stop transaction due to perf issues
MODIFY
src/storage/mongodb/DatabaseUtils.ts
src/storage/mongodb/DatabaseUtils.ts
@@ -96,8 +96,7 @@ export default class DatabaseUtils {
public static pushTagLookupInAggregation(lookupParams: DbLookup, additionalPipeline: Record<string, any>[] = []): void {
DatabaseUtils.pushCollectionLookupInAggregation('tags', {
- objectIDFields: ['lastChangedBy'],
- projectedFields: ['id', 'description', 'visualID', 'issuer', 'active', 'ocpiToken', 'lastChangedBy', 'lastChangedOn'],
+ objectIDFields: ['createdBy', 'lastChangedBy'],
...lookupParams
}, additionalPipeline);
}

MODIFY
src/storage/mongodb/TransactionStorage.ts
src/storage/mongodb/TransactionStorage.ts
@@ -699,10 +699,11 @@ export default class TransactionStorage {
tenantID, aggregation: aggregation, asField: 'tag', localField: 'tagID',
foreignField: '_id', oneToOneCardinality: true
});
- DatabaseUtils.pushTagLookupInAggregation({
- tenantID, aggregation: aggregation, asField: 'stop.tag', localField: 'stop.tagID',
- foreignField: '_id', oneToOneCardinality: true
- });
+ // TODO: [To Investigate] Cause big perf issue in prod (local it takes 2sec with this lookup instead of 165ms, in prod it can takes up to 20s)
+ // DatabaseUtils.pushTagLookupInAggregation({
+ // tenantID, aggregation: aggregation, asField: 'stop.tag', localField: 'stop.tagID',
+ // foreignField: '_id', oneToOneCardinality: true
+ // });
}
// Company
if (params.withCompany) {

Commented get tags in stop transaction due to perf issues