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

Fix race condition bug where activating multiple features sequentially could fail to activate some features #1675

Conversation

b1ink0
Copy link
Contributor

@b1ink0 b1ink0 commented Nov 19, 2024

Summary

Fixes #1660

Relevant technical choices

Implemented a queue based approach for activation of features / plugins using the AJAX in JavaScript.

Now only one features / plugin sends a request at a time other request are processed after previous request is finished.

Demo

demo-2.mp4

Copy link

github-actions bot commented Nov 19, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: b1ink0 <[email protected]>
Co-authored-by: mukeshpanchal27 <[email protected]>
Co-authored-by: westonruter <[email protected]>
Co-authored-by: felixarntz <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@mukeshpanchal27 mukeshpanchal27 added [Type] Bug An existing feature is broken [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only labels Nov 19, 2024
@mukeshpanchal27 mukeshpanchal27 added this to the performance-lab 3.6.1 milestone Nov 19, 2024
@mukeshpanchal27 mukeshpanchal27 added no milestone PRs that do not have a defined milestone for release and removed no milestone PRs that do not have a defined milestone for release labels Nov 19, 2024
Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

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

Thanks @b1ink0 for the PR.

When plugins are activated simultaneously, while some plugins in the waiting state reloading the settings page. After the reload, some plugins display the Activate button again, even though they are already installed and activated, while others remain unactivated.

This is not a blocker but something I observed during testing.

Screen.Recording.2024-11-19.at.5.11.14.PM.mov

@b1ink0
Copy link
Contributor Author

b1ink0 commented Nov 19, 2024

When plugins are activated simultaneously, while some plugins in the waiting state reloading the settings page. After the reload, some plugins display the Activate button again, even though they are already installed and activated, while others remain unactivated.

@mukeshpanchal27
I believe this is happening because when the plugin is in the Activating... state, the request to activate the plugin is sent. If you reload quickly, it will show Activate because the request to activate the plugin is not finished. This means the plugin is not activated yet, which correctly reflects on the Performance Features page. Then, when you later go to the plugins page, it shows the plugins as activated because the request to activate the plugin has now finished.

demo-3.mp4

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

LGTM

@felixarntz felixarntz changed the base branch from trunk to release/3.6.1 November 19, 2024 21:27
@felixarntz
Copy link
Member

FYI I've changed the base branch to a new release/3.6.1, since this should go into a hot fix release for purely this fix.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@b1ink0 This looks great, thank you for the fix and fast turnaround time!

@felixarntz felixarntz merged commit d4f0938 into WordPress:release/3.6.1 Nov 19, 2024
19 of 25 checks passed
@felixarntz felixarntz changed the title Activating multiple features / plugins sequentially fails to activate some features / plugins Fix race condition bug where activating multiple features sequentially could fail to activate some features Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Bug An existing feature is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Activating multiple features / plugins sequentially fails to activate some features / plugins
4 participants