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

Added function to check against running/pending/successful cron tasks #23312

Merged
merged 3 commits into from
Jun 26, 2019
Merged

Added function to check against running/pending/successful cron tasks #23312

merged 3 commits into from
Jun 26, 2019

Conversation

chickenland
Copy link
Contributor

This PR adds function to filter all correctly run, running or pending cron tasks.

Description (*)

If a cron has just been run, cache is cleared and the cron processed again, then scheduled tasks reschedule for the same time.

Fixed Issues (if relevant)

  1. Cron schedule is being duplicated #21380: Cron schedule is being duplicated

Manual testing scenarios (*)

When not updated, running bin/magento cron:run && bin/magento cache:flush repeatedly will cause tasks that have completed to be rescheduled - leading to many tasks repeating. This should no longer happen.

@m2-assistant
Copy link

m2-assistant bot commented Jun 18, 2019

Hi @chickenland. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

Hi @chickenland,
Thank you for contribution! Your changes looks good to me.

Unfortunately there is failing static tests. Could you fix code to make tests pass, squash all changes into single commit and force push?

Also looks like method getPendingSchedules not used anymore and should be safely removed

Thank you in advance

@ghost ghost assigned ihor-sviziev Jun 19, 2019
@chickenland
Copy link
Contributor Author

Pushed up changes that should fix the tests.

I believe that getPendingSchedules is still used within processPendingJobs and shouldn't be removed at this time.

Added type missing for static call

Updated static code tests again
@chickenland
Copy link
Contributor Author

Pushed another series - I might need a pointer on what is failing as I can't figure it out from the message that's returned.

@chickenland
Copy link
Contributor Author

@engcom-Foxtrot engcom-Foxtrot self-assigned this Jun 21, 2019
@engcom-Foxtrot
Copy link
Contributor

@ihor-sviziev @chickenland static tests fixed.

@chickenland
Copy link
Contributor Author

Thanks @engcom-Foxtrot ! Was it just a case of addressing the ones that couldn't be auto fixed? From the looks of it, this was around things I don't think I'd changed :/

@sivaschenko
Copy link
Member

@magento run all tests

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-5335 has been created to process this Pull Request
✳️ @ihor-sviziev, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@ihor-sviziev ihor-sviziev added the Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests label Jun 21, 2019
@engcom-Alfa engcom-Alfa self-assigned this Jun 24, 2019
@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Before:

before

After:

after

@m2-assistant
Copy link

m2-assistant bot commented Jun 26, 2019

Hi @chickenland, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@anuprasadkummali
Copy link

i am getting this swarm of cron in scheduler suspect this to be the reason behind high cpu usage. Magento CE 2.3.4

3696244 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:06:00 | NULL | NULL |
| 3696245 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:07:00 | NULL | NULL |
| 3696246 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:08:00 | NULL | NULL |
| 3696247 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:09:00 | NULL | NULL |
| 3696248 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:10:00 | NULL | NULL |
| 3696249 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:11:00 | NULL | NULL |
| 3696250 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:12:00 | NULL | NULL |
| 3696251 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:13:00 | NULL | NULL |
| 3696252 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:14:00 | NULL | NULL |
| 3696253 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696254 | yotpo_yotpo_orders_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:16:00 | NULL | NULL |
| 3696255 | ddg_automation_customer_subscriber_guest_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696257 | ddg_automation_importer | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:10:00 | NULL | NULL |
| 3696258 | ddg_automation_importer | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696259 | ddg_automation_status | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696261 | ddg_automation_abandonedcarts | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:10:00 | NULL | NULL |
| 3696262 | ddg_automation_abandonedcarts | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696263 | ddg_automation_reviews_and_wishlist | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696265 | ddg_automation_campaign | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:10:00 | NULL | NULL |
| 3696266 | ddg_automation_campaign | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696267 | ddg_automation_order_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696268 | ddg_automation_catalog_sync | pending | NULL | 2020-08-29 16:57:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696274 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:06:00 | NULL | NULL |
| 3696275 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:07:00 | NULL | NULL |
| 3696276 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:08:00 | NULL | NULL |
| 3696277 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:09:00 | NULL | NULL |
| 3696278 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:10:00 | NULL | NULL |
| 3696279 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:11:00 | NULL | NULL |
| 3696280 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:12:00 | NULL | NULL |
| 3696281 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:13:00 | NULL | NULL |
| 3696282 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:14:00 | NULL | NULL |
| 3696283 | indexer_reindex_all_invalid | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:15:00 | NULL | NULL |
| 3696289 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:06:00 | NULL | NULL |
| 3696290 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:07:00 | NULL | NULL |
| 3696291 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:08:00 | NULL | NULL |
| 3696292 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:09:00 | NULL | NULL |
| 3696293 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:10:00 | NULL | NULL |
| 3696294 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:11:00 | NULL | NULL |
| 3696295 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:12:00 | NULL | NULL |
| 3696296 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:13:00 | NULL | NULL |
| 3696297 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:14:00 | NULL | NULL |
| 3696298 | indexer_update_all_views | pending | NULL | 2020-08-29 17:00:07 | 2020-08-29 17:15:00 | NULL | NULL

@ihor-sviziev
Copy link
Contributor

@anuprasadkummali
Could you report separate issue with more info about steps to reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests Component: Cron Partner: Pinpoint partners-contribution Pull Request is created by Magento Partner Progress: accept Release Line: 2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants