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

Syncing carts + orders + promotions need refactoring #36

Open
jlachancekffein opened this issue Aug 19, 2020 · 1 comment
Open

Syncing carts + orders + promotions need refactoring #36

jlachancekffein opened this issue Aug 19, 2020 · 1 comment

Comments

@jlachancekffein
Copy link

The way it's done right now, it is impossible to synchronize resources when there is a high count.

The problem is, the queue has to process all the elements at once.

To adjust locally, I added one item at a time to the queue. For example, if there are 2000 orders to synchronize, I add 2000 queue jobs for processing all the orders.

That way, no matter how many items you need to process, I'm sure the job won't crash.

Here is an example of one of the controller actions :

$ordersIds = Order::find()->isCompleted(true)->ids();
foreach ($ordersIds as $ordersId) {
   Craft::$app->getQueue()->push(
      new SyncOrders(['orderIds' => [$ordersId]])
   );
}
@jlachancekffein jlachancekffein changed the title Synching carts / orders / promotions need refactoring Syncing carts + orders + promotions need refactoring Aug 19, 2020
@peteeveleigh
Copy link

As per this issue from May 2020 #30

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

No branches or pull requests

2 participants