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

refactor: data sync performance optimisation #634

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

pavelshulga
Copy link
Contributor

  • Add category resource to minimise a need to request category information for each category item, instead relying on full category tree names snapshot.
  • Prevent data sync from triggering in the context of setup:upgrade command, instead being conducted only in the context of dedicated dotdigital:migrate command.
  • Prevent pending automation processing within setup:upgrade command context. To be handled instead within normal automation processing context.
  • Minor code refactoring better adhering to methods signatures (e.g. in Consent.php try{}catch block). Add logger in Order.php since no explicit dependency injected but used in the business logic implementation.

Add category resource to minimise a need to request category information for each category item, instead relying on full category tree names snapshot.
Prevent data sync from triggering in the context of `setup:upgrade` command, instead being conducted only in the context of dedicated `dotdigital:migrate` command.
Prevent pending automation processing within `setup:upgrade` command context. To be handled instead within normal automation processing context.
Minor code refactoring better adhering to methods signatures (e.g. in Consent.php try{}catch block).
Add logger in Order.php since no explicit dependency injected but used in the business logic implementation.
@@ -39,7 +39,7 @@ public function __construct(
*/
public function apply()
{
$this->automationFactory->create()->sync();
//$this->automationFactory->create()->sync();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The assumption is that this model is not used by CLI/cron job and this change won't prevent automation processing.

Copy link
Contributor

Choose a reason for hiding this comment

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

This patch was added when we introduced queues for automation processing. It was possible at point of upgrade that a merchant still has some residual automations in the table (up to 15 mins' worth) which would not be queued and therefore left to become stale. Without this merchants would need to remember / be reminded to do this to process remaining old-style automations.

if (count($names)) {
return implode(',', $names);
if (!$this->connectorCategoryModel) {
$this->connectorCategoryModel = ObjectManager::getInstance()->get(ConnectorCategoryModel::class);
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why this is necessary if the class was injected in the constructor in the usual way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @sta1r

That snippet was maintained there since the original solution was applied as a patch. You are right, DI should suffice and the use of objectManager to be deleted/discouraged.

@sta1r
Copy link
Contributor

sta1r commented Sep 18, 2024

@pavelshulga plenty of good improvements here which we will aim to include in the coming sprints. 👍

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.

2 participants