- Issue created by @djdevin
- π©πͺGermany Antonnavi Berlin
Hello all here,
Here is implementation of Batch usage on publishing (to Live workspace).
- Status changed to Needs review
5 months ago 2:22pm 24 August 2024 - Status changed to Needs work
5 months ago 7:00pm 24 August 2024 - πΊπΈUnited States smustgrave
Thanks for opening. Feature sounds interesting but fixes should be in an MR.
Also will need test coverage.
- First commit to issue fork.
- Merge request !9325Extend execution time for publishing large workspaces. β (Closed) created by amateescu
- Status changed to Needs review
5 months ago 8:38am 26 August 2024 - π·π΄Romania amateescu
We can't use a batch because workspaces can also be published via the CLI or by cron, for example during a scheduled deployment. In order for that work correctly, we would need something like β¨ Add an 'instant' queue runner Needs work and/or π Make batch a wrapper around the queue system Needs work .
We've solved this problem in the Workspace Extras β module by extending the PHP execution time after each entity save, but we can improve that solution and only do it for large workspaces.
Opened a MR for this. Testing this would only increase the testing times artificially so I don't think it's worth it. Manual testing can be done locally using Devel generate or some custom code to create 1000 or more entities in a workspace.
- πΊπΈUnited States smustgrave
Should this be postponed on β¨ Add an 'instant' queue runner Needs work ?
- π·π΄Romania amateescu
@smustgrave, I don't think so. The current MR provides an immediate fix for the problem, while using a queue or something similar would need to figure out how to provide data integrity at the database level, which is very important when there's an error during the deployment of a workspace and every change needs to be rolled back.
- Status changed to RTBC
5 months ago 4:04pm 10 September 2024 - πΊπΈUnited States smustgrave
Agree that testing would probably not be worth it to extend time.
Reviewing the code to execution believe it's right
Tested by creating a workspace and generating a number of content items.
Publishing still works. - π³πΏNew Zealand quietone
@smustgrave, how many content items did you create and test?
Since that is important to this particular change I am changing the status.
- π·π΄Romania amateescu
Here's a relatively quick way to test this:
- change your
php_execution_time
to something very low, like 3 seconds
- run this script with Drushdrush ev ' $workspace = \Drupal::entityTypeManager()->getStorage("workspace") ->create(["id" => "test_3469792", "label" => "Test 3469792"]); $workspace->save(); \Drupal::service("workspaces.manager")->executeInWorkspace($workspace->id(), function () use ($workspace) { for ($i = 1; $i <= 5000; $i++) { \Drupal::entityTypeManager()->getStorage("path_alias") ->createWithSampleValues("path_alias", [ "workspace" => $workspace->id(), ]) ->save(); } }); '
Then go to
/admin/config/workflow/workspaces
, activate that workspace and try to publish it. Without the MR you should get an error about max execution time exceeded, and with it the workspace will be published successfully. - πΊπΈUnited States smustgrave
Sorry I should of been more clear but I followed the suggestion of using devel generate to create 1000 dummy nodes.
- π¬π§United Kingdom catch
Environment::setTimeLimit()
is on its way out, see π Deprecate Environment::setTimeLimit() with no replacement Active and [#74617], should we just use the raw PHP API instead here? The Needs Review Queue Bot β tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide β to find step-by-step guides for working with issues.
- π¬π§United Kingdom catch
Thanks that looks good.
Committed/pushed to 11.x and cherry-picked back through to 10.3.x, thanks!
Automatically closed - issue fixed for 2 weeks with no activity.