Skip to content

Conversation

@2ndkauboy
Copy link

@2ndkauboy 2ndkauboy commented Nov 9, 2022

Description
In certain situations, a project can get locked. If this happens, there is currently no way to unlock it, except for removing the lock in the database directly.

How has this been tested?
In a custom plugin, this command has been registered as a new command in a different namespace, and it could be tested successfully as expected.

Types of changes
New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code has proper inline documentation.

@swissspidy
Copy link
Collaborator

Would wp post meta delete <projectid> _traduttore_update_lock work just as well here?

In certain situations, a project can get locked.

Do you perhaps know what happened in your case? Was there some kind of error perhaps?

I am asking because the lock is supposed to be removed right away after updating:

$this->updater->add_lock();
$local_repository = $cached ? $this->loader->get_local_path() : $this->loader->download();
if ( ! $local_repository || ! is_dir( $local_repository ) ) {
$this->updater->remove_lock();
return false;
}
$configuration = new Configuration( $local_repository );
$result = $this->updater->update( $configuration );
$this->updater->remove_lock();

So I am curious to get to the bottom of this.

As an alternative, we could think about simply adding a timestamp as the meta value for the lock and then create some cron job to clean up stale locks.

No manual intervention needed in this case :-)

@codecov
Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 0% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 71.57%. Comparing base (5f49923) to head (92431e9).

Files Patch % Lines
inc/CLI/ProjectCommand.php 0.00% 16 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #247      +/-   ##
============================================
- Coverage     72.47%   71.57%   -0.91%     
  Complexity      350      350              
============================================
  Files            29       29              
  Lines          1268     1284      +16     
============================================
  Hits            919      919              
- Misses          349      365      +16     
Flag Coverage Δ
feature 13.39% <0.00%> (-0.17%) ⬇️
php 79.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@swissspidy swissspidy requested a review from ocean90 May 16, 2024 20:48
@swissspidy swissspidy added this to the 4.0.0 milestone May 17, 2024
Copy link
Member

@ocean90 ocean90 left a comment

Choose a reason for hiding this comment

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

I don't believe we need a dedicated CLI command for this. We're using Traduttore many years and never had this issue.

If you have to unlock a project you probably want to run an update right after it, correct? Why not remove an existing lock as part of the update command? Or should the update command also set a lock and you can pass --force to ignore/delete an existing lock?

@2ndkauboy
Copy link
Author

I don't mind having a different solution to that. Just as of now, there is no straightforward way to unlock a project. This issue came up trying to unlock a project on a WordPress VIP hosting environment, where you don't have direct access to the database and also some WP-CLI commands are forbidden.

@felipemarcos
Copy link

It's possible for a lock to be acquired and never released, with no warnings, causing the project to hang indefinitely. I disabled the lock logic on my wp install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants