bentonow / bento-wordpress-sdk

🍱 Bento WordPress & WooCommerce plugins
4 stars 5 forks source link

Cron Overload #12

Open jessehanley opened 2 years ago

jessehanley commented 2 years ago

Hey @codemonkey-jack and @estevao90,

Would it be possible to add a toggle to turn the bento_learndash_scheduled_events_hook() on and off? With default being off? We have sites that are DDoSing us hourly because of it — it's just way too much event data to send our way.

Code found here: https://github.com/bentonow/bento-wordpress-sdk/blob/e632d29a3ed16b21d1d21b9c704c2be5aa09ec40/inc/events-controllers/class-learndash-bento-events.php#L327-L334

Screenshot of events coming in: image

Appreciate it!

estevao90 commented 2 years ago

Hi Jesse!

That function is related to the options below: image

So you can control the frequency and enable/disable that function.

Examples:

Now, the default value is 0. So it's already disabled by default. Please let me know if you need anything else.

jessehanley commented 2 years ago

Hey @estevao90,

Thanks for replying!

I don't know if that is true though. The user this is an issue with has the following setup:

image

Based on this and your explanation, no events should be sending.

But the WP install is sending us so many events still:

image

Why is this?

jessehanley commented 2 years ago

I'm a bit of a PHP n00b but reading the file, it seems the cron is registered but no checks are made for bento_learndash_scheduled_events_hook()?

https://github.com/bentonow/bento-wordpress-sdk/blob/e632d29a3ed16b21d1d21b9c704c2be5aa09ec40/inc/events-controllers/class-learndash-bento-events.php#L327

estevao90 commented 2 years ago

Hi, Jesse!

Oh, I got the issue. We're not updating the cron register. So, the cron is still registered and active. I'll send a fix by the following week.

To fix it now, you can just delete the related cron tasks. To do it, you can install the WP Crontrol plugin and go to Tools -> Control events. Then, you'll be able to delete the bento tasks (image below). Sorry for that! image

jessehanley commented 2 years ago

Sweet! I'll ping impacted clients, tag me when you do the release @estevao90 ✌️

Thanks brother!

estevao90 commented 2 years ago

@jessehanley I pushed the fix for that issue.

Please let me know if it works well in their case.

jessehanley commented 2 years ago

@estevao90 sweet, merged in and will send to peeps.

One of the users mentioned that deleting the cron didn't work as it would keep appearing again and again.

Does this fix tackle that too?

estevao90 commented 2 years ago

Ah, Yep! I fixed it.

jessehanley commented 2 years ago

Hey @estevao90 — the user has tried to remove the cron multiple times but it keeps appearing. Any ideas? I have to now request he remove the plug-in because of the event volume he's sending.

estevao90 commented 2 years ago

Hi @jessehanley

Is the user using the latest committed version? Any chance I have access to their environment? So I can investigate the issue as I can't replicate that problem here.

Ah, that problem happens with all customers or it's a specific user issue?

It's weird because even the previous version doesn't have this problem here.