Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

add action scheduler package via composer #3557

Closed
wants to merge 15 commits into from
Closed

Conversation

rrennick
Copy link
Contributor

@rrennick rrennick commented Jan 14, 2020

This PR loads Action Scheduler 3.1.0 via composer.

It removes the custom AS post store which had the priority setting code.

Detailed test instructions:

add_action( 'admin_menu', function() {
error_log(ActionScheduler_Versions::instance()->latest_version());	
});
  • Load a dashboard page
  • Deactivate Action Scheduler
  • debug.log should have
[14-Jan-2020 20:07:49 UTC] 3.0.2
[14-Jan-2020 20:07:52 UTC] 3.0.2
[14-Jan-2020 20:07:52 UTC] 3.0.1
  • Re-import your analytics data
  • verify order & customer imports processed correctly

Changelog Note:

Dev: Add Action Scheduler 3.1.0

@rrennick rrennick added [Status] Needs Review tool: monorepo infrastructure status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. focus: performance The issue/PR is related to performance. labels Jan 14, 2020
@rrennick rrennick removed the status: blocked The issue is blocked from progressing, waiting for another piece of work to be done. label Jan 15, 2020
Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

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

[15-Jan-2020 22:01:55 UTC] 3.0.2
[15-Jan-2020 22:02:02 UTC] 3.0.2
[15-Jan-2020 22:02:07 UTC] 3.0.2
[15-Jan-2020 22:02:07 UTC] 3.0.1

Testing well for me, and again really liked the messaging updates during the queue migration in AS 👏

I want to run some more tests on this branch, like do some historical imports and such, but so far this is looking and working great.

src/Schedulers/SchedulerTraits.php Show resolved Hide resolved
@@ -107,7 +107,7 @@ public function test_import_params() {
$order_2->save();

// Delete order stats so we can test import API.
$wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type = 'scheduled-action'" );
ReportsSync::clear_queued_actions();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

@timmyc
Copy link
Contributor

timmyc commented Jan 16, 2020

@rrennick just saw the label change, is this good to test further or were you going to do some more work?

@rrennick
Copy link
Contributor Author

is this good to test further or were you going to do some more work?

I need to address the issue with the unit tests not passing.

@rrennick
Copy link
Contributor Author

Adding a note here on the reasons for the changes to the unit tests:

  • In the WP Post store, the pending action list is retrieved with a default ordering of action ID ASC. In normal queue processing, the custom store does order actions by action id on the innermost sort. Our unit tests bypass the normal queue processing and just processes a list of retrieved actions. Tests were intermittently failing because 2 orders created for the same customer might not be processed in the same order on every execution.
  • The PR changes some assumptions to explicit requirements in the batch queue tests.

@timmyc This is ready for another review. Can we add a February release to Zenhub to move this PR to?

output 3 "Updating package textdomains..."

# Replace text domains within packages with woocommerce
find ./vendor/action-scheduler -iname '*.php' -exec sed -i.bak -e "s/'action-scheduler' /'woocommerce-admin' /g" -e "s/\"action-scheduler\" /'woocommerce-admin' /g" {} \;
Copy link
Contributor

Choose a reason for hiding this comment

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

We are improving it on WooCommerce core, so we avoid replacing non-translatable strings: woocommerce/woocommerce#25536

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@claudiosanches Thanks for pinging us with this. In case you find it useful, I added a --no-warnings to the node command in our implementation so it wouldn't output a line for every text domain it updated.

@rrennick rrennick changed the base branch from master to version/1.0 February 11, 2020 20:37
@rrennick
Copy link
Contributor Author

@timmyc This is updated to AS 3.1 and ready for another review.

@jeffstieler
Copy link
Contributor

Is a specific version of WC required for this?

I'm getting these errors after disabling the AS plugin:

PHP Fatal error:  Uncaught Error: Call to undefined function as_get_scheduled_actions() in /srv/www/wordpress-default/public_html/wp-content/plugins/woocommerce/includes/queue/class-wc-action-queue.php:158
Stack trace:
#0 /srv/www/wordpress-default/public_html/wp-content/plugins/woocommerce-admin/src/Schedulers/ImportScheduler.php(43): WC_Action_Queue->search(Array)
#1 /srv/www/wordpress-default/public_html/wp-content/plugins/woocommerce-admin/src/ReportsSync.php(65): Automattic\WooCommerce\Admin\Schedulers\ImportScheduler::is_importing()
#2 /srv/www/wordpress-default/public_html/wp-content/plugins/woocommerce-admin/src/ReportsSync.php(133): Automattic\WooCommerce\Admin\ReportsSync::is_importing()
#3 /srv/www/wordpress-default/public_html/wp-content/plugins/woocommerce-admin/src/API/Reports/Import/Controller.php(289): Automattic\WooCommerce\Admin\ReportsSync::get_import_stats()
#4 /srv/www/wordpress-default/public_html/wp-includes/rest-api/class-wp-rest-server.php(946): Automattic\WooCommerce\Admin\API\Reports\Import\Controlle in /srv/www/wordpress-default/public_html/wp-content/plugins/woocommerce/includes/queue/class-wc-action-queue.php on line 158

@rrennick
Copy link
Contributor Author

I'm getting these errors after disabling the AS plugin:

Did you run composer install? If you ran that in another branch AS may have been removed.

@jeffstieler
Copy link
Contributor

Yes I ran composer install (just did again to be sure even) - I'm getting those PHP errors when loading the Analytics > Settings page.

@rrennick
Copy link
Contributor Author

@jeffstieler To proceed with this PR we would need to include action-scheduler.php before vendor/autoload.php. Do you have any concerns about doing that?

@jeffstieler
Copy link
Contributor

To proceed with this PR we would need to include action-scheduler.php before vendor/autoload.php. Do you have any concerns about doing that?

Can you elaborate on why the autoloader isn't able to handle this use case?

@rrennick
Copy link
Contributor Author

Can you elaborate on why the autoloader isn't able to handle this use case?

See woocommerce/action-scheduler#468 (comment)

@rrennick rrennick added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed [Status] Needs Review labels Feb 20, 2020
@timmyc
Copy link
Contributor

timmyc commented Mar 3, 2020

@rrennick guessing we might be closing this one out?

@rrennick
Copy link
Contributor Author

rrennick commented Mar 3, 2020

Due to the issue with composer autoloading we didn't have time in the core release schedule to implement this.

@rrennick rrennick closed this Mar 3, 2020
@rrennick rrennick deleted the try/package-as branch March 3, 2020 12:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: performance The issue/PR is related to performance. needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. tool: monorepo infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants