Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregated optimization changes #2744

Merged
merged 24 commits into from
Mar 20, 2024

Conversation

monrostar
Copy link
Contributor

@monrostar monrostar commented Mar 16, 2024

Related issue: #2738

@monrostar
Copy link
Contributor Author

monrostar commented Mar 16, 2024

@michaelbromley
I created this PR to pull all the changes together and refactor them to avoid conflicts.

In this PR I will optimize queries inside TransactionalConnection, it turned out to be difficult because there are assets inside collections that don't have reverse relation. We need to figure something out, maybe this relation can be found through metadata

The problem arises at this point

@ManyToOne(type => Asset, { eager: true, onDelete: 'CASCADE' })

@monrostar monrostar changed the title Feat/aggregated prs Aggregated optimization changes Mar 17, 2024
@monrostar
Copy link
Contributor Author

monrostar commented Mar 17, 2024

image @michaelbromley We are just a little bit away from the final optimization of the most important methods

In overview:

  1. ListQueryBuilder.build was refactored and covered more edgecases
  2. softDelete from ProductService was optimized
  3. Get existing translations for TranslatorSaver.update was optimized
  4. assignToChannel from ChannelService was optimized
  5. findOneInChannel and findByIdsInChannel were optimized in TransactionalConnection

Also, this PR includes fixes that address this issue #2738

@tianyingchun
Copy link
Contributor

how progress of this PR :)

@monrostar
Copy link
Contributor Author

monrostar commented Mar 19, 2024 via email

# Conflicts:
#	packages/core/src/service/helpers/entity-hydrator/entity-hydrator.service.ts
#	packages/core/src/service/helpers/list-query-builder/list-query-builder.ts
#	packages/core/src/service/services/channel.service.ts
@monrostar monrostar marked this pull request as ready for review March 19, 2024 17:22
@monrostar
Copy link
Contributor Author

PR is ready 🚀

Copy link
Member

@michaelbromley michaelbromley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Just a couple of small "tidy up" points. Thanks again for this incredible effort.

* has already been joined to avoid adding duplicate join statements.
* @returns boolean Returns true if the relation has already been joined (based on the alias), false otherwise.
* @template T extends VendureEntity The entity type for which the query builder is configured.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this doc block is out of place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't know how to do it here. If you have recommendations, I'd be glad to change it and maybe I need to reduce the amount of text...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this doc block is out of place?

I deleted the documentation that was accidentally copied and updated the documentation I was adding for the method. Check it out, please.

@@ -24,7 +24,7 @@ export abstract class OrderableAsset extends VendureEntity implements Orderable
assetId: ID;

@Index()
@ManyToOne(type => Asset, { eager: true, onDelete: 'CASCADE' })
@ManyToOne(type => Asset, { eager: true, onDelete: 'CASCADE' })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

done

} from 'typeorm';
import { DataSource } from 'typeorm/data-source/DataSource';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this (and the InjectDataSource above) really be deep imports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will fix it. this is from my IDE, I didn't noticed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

should this (and the InjectDataSource above) really be deep imports?

@michaelbromley michaelbromley merged commit 48b239b into vendure-ecommerce:minor Mar 20, 2024
10 of 12 checks passed
@monrostar monrostar deleted the feat/aggregated-prs branch March 20, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants