daheadcracker
Forum Replies Created
-
Hi, we moved the site now to a bigger server and I adjusted the action scheduler so that it can run 5 simultaneous queues to keep up with the wc_amazon_async_polling hooks. But this is of course no long term solution.
In addition I had to rename all pending wc_amazon_async_polling hooks so they get out of the queues. Result is, they seem to recreate themself after a while (I guess when an apa order is processed). I did not see apa renewal orders failing for that reason.
So I still don’t get why an async polling for the “CHARGE_PERMISSION” is necessary in the first place (especially that often), because I guess the permission to charge will be checked while processing the orders anyway.
Please help in at least suggesting a hotfix for the issue.Forum: Plugins
In reply to: [Conditional Logic for Woo Product Add-ons] WC Product bundles compatibilityOk, Thanks for taking care of this. In the meantime I had to do some other adjustments:
- Whenever one of the variations in the bundle was changed, the other bundle products lost their selected product addons, therefore I needed to filter for the attribute of the variations.
// Variation dependencies
jQuery(‘.bundled_product’).on(‘found_variation’, (function (e, variation) {
if( variation.attributes[‘attribute_pa_attr1’] || variation.attributes[‘attribute_pa_attr2’] ){
this.selectedVariation = variation[‘variation_id’];
this.triggerConditionalRules();
}
}).bind(this));
2. When I made a bundle product optional, clicking the checkbox lead to also loose the selected addons of the other products in the bundle. Therefore I needed to check if the variation of that product is actually set when the reset_data event triggers:
jQuery(document).on(‘reset_data’, (function (e, variation) {
if(variation != undefined){
this.selectedVariation = 0;
this.triggerConditionalRules();
}
}).bind(this));
Hope this helps you with the new release.
- This reply was modified 1 year, 8 months ago by daheadcracker.
Forum: Plugins
In reply to: [Conditional Logic for Woo Product Add-ons] WC Product bundles compatibilityHi, ok I will do that. But it could be also beneficial for other users I think, as other scripts of other plugins could also lead to the same issue, and now that I dug a bit mor into the code I can see why it is happening.
“wp-content/plugins/woocommerce-product-bundles/assets/js/frontend/add-to-cart-bundle.js”
is like your plugin also listening to the “found_variation” event. But in the end of its callback function it is calling “event.stopPropagation();” which is preventing the event Propagation to your script here:
“wp-content/plugins/conditional-logic-for-woocommerce-product-add-ons-premium/assets/frontend/frontend.js”
So I’m currently looking for a way to prioritize your eventlistener before the one of the product bundles plugin. I see you enqueue your script here:
wp-content/plugins/conditional-logic-for-woocommerce-product-add-ons-premium/src/Frontend/Frontend.php
I tried to prioritize your script using the add_action( ‘wp_enqueue_scripts’, … method whithout success.
But I guess it comes down to this jQuery logic:
https://stackoverflow.com/questions/8779657/priority-when-more-than-one-event-handler-is-bound-to-an-element-via-jquery
I tested now adding a second listener to the “bundled_item” div instead of the document (like described in above link) which is a direct child of the cart form, exactly like the product bundle plugin is also doing it and it works:// Product Bundles Support
jQuery(‘.bundled_product’).on(‘found_variation’, (function (e, variation) {
this.selectedVariation = variation[‘variation_id’];
this.triggerConditionalRules();
}).bind(this));
Ok, hooking an additional listener onto the ‘.bundled_product’ class seems to solve the issue.
- This reply was modified 1 year, 8 months ago by daheadcracker.
- This reply was modified 1 year, 8 months ago by daheadcracker.
- This reply was modified 1 year, 8 months ago by daheadcracker.
- This reply was modified 1 year, 8 months ago by daheadcracker.
- This reply was modified 1 year, 8 months ago by daheadcracker.
- This reply was modified 1 year, 8 months ago by daheadcracker.
- This reply was modified 1 year, 8 months ago by daheadcracker.
Hey @christian1983
the hook “wc_amazon_async_polling” is being used for checking the status of Amazon charges and charge permissions async.But why is it that the hook with the same args ([“BXX-XXXXXXX-XXXXXXX”,”CHARGE_PERMISSION”])/ for the same order needs to run almost 10 times a day for every day?
public function schedule_hook( $id, $type ) { $args = array( $id, $type ); // Schedule action to check pending order next hour. if ( false === $this->is_next_scheduled( 'wc_amazon_async_polling', $args, 'wc_amazon_async_polling' ) ) { wc_apa()->log( sprintf( 'Scheduling check for %s %s', $type, $id ) ); as_schedule_single_action( strtotime( '+10 minutes' ), 'wc_amazon_async_polling', $args, 'wc_amazon_async_polling' ); } }According to “wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/includes/class-wc-amazon-payments-advanced-ipn-handler.php:542” it seems to me as after an event “wc_amazon_async_polling” has run, the next one is beenig scheduled in 10 Minutes?
Why does this plugin need to run a polling functionality in the first place? e.g. the Stripe and Paypal plugins don’t need that and are running code only when it’s necessary e.g. while loading the order edit page in backend or while processing scheduled payments.The removal of the completed actions in the database should be handled by Action Scheduler itself after 30 days of their completion. Do you have completed actions older than that? In the article, there is also an example to use a filter and change the 30 days settings period.Yes there are older completed entries for this hook. For whatever reason the automated cleanup seems to work for hooks like ‘wc-admin_import_orders’ or ‘woocommerce_scheduled_subscription_payment’ but not for the ‘wc_amazon_async_polling’ hook.
I have lowered the cleanup schedule already to 7 days.
So I guess I can also delete the ‘complete’ and ‘failed’ together with the matching log entries manually, right?
Thanks
Regards- This reply was modified 2 years, 11 months ago by daheadcracker.
Hi @christian1983 ,
The average orders per day is up to now in this year at 161.7 for the amazon pay gateway.Finally with the release of Version 2.1.0 this issue got fixed by setting a transient for 3 month if the query for the ppec subscriptions returns no results. Thanks.
Thanks for the quick response. I’ll give this filter a try and report back if I face anymore issues.
Hi,
I reset the status to not resolved, as it is still not resolved. Still frequently (often even without initiating an update of the plugin manually / auto updates disabled) my commented code gets overritten and the plugin decides to spam the processlist of our DB that much, that the site goes down. Here again what is beeing spammed by the site_has_ppec_subscriptions method:
SELECT 1 FROM posts p
JOIN postmeta pm ON pm.post_id = p.ID
WHERE p.post_type = 'shop_subscription'
AND p.post_status != 'trash'
AND pm.meta_key = '_payment_method'
AND pm.meta_value = 'ppec_paypal'
LIMIT 1- This reply was modified 3 years, 2 months ago by daheadcracker.