MindblownHQ / wooping-shop-health

The WooCommerce Shop Health plugin by Wooping
https://wooping.io
2 stars 1 forks source link

Clear current scan when a new one is triggered #15

Open mklasen opened 1 month ago

mklasen commented 1 month ago

It's currently possible to run multiple full scans simultaneously. This causes the progress bar (introduced in 279) to report a negative count and percentage.

Relevant comment:

The above indeed originates from when multiple scans are running. I think we have to solve this in a separate PR though, a new product scan should either:

  • Not be possible while another is running
  • Cancel all existing jobs and start again

Let's tackle this in a new issue

Originally posted by @mklasen in https://github.com/MindblownHQ/shop-health/issues/279#issuecomment-2377045557

I'm in favor of clearing all current scans when a new scan is triggered.

lucprincen commented 1 month ago

Check. I agree. Additionally, we check the amount of pending scan_product events against the total amount of products, so thinking about this further... if you rapid-save multiple products you could technically also break this, as it will just never get to 100%...

I'd say we also need to add a timestamp on post_save and on the batch-job to denote when scanning started again. That way I can query the pending jobs against the completed jobs and always get the correct number.

lucprincen commented 3 days ago

Related: #1