This module is very useful for configuring memory limit for pages. We come across a scenario, where we have increase memory limit for a specific drush command, since there is no such option present, so we have to raise memory limit of all drush commands in settings.php as mentioned here https://www.drupal.org/node/2295037.
It would be great to have options to raise memory limit for specific command using Memory limit policy, similar to specific page.

Comments

Sharique created an issue. See original summary.

sharique’s picture

I checked the memory limit policy module, and it works on "KernelEvents::REQUEST", which doesn’t work in case of Drush. We need to look for any other approach to increase the memory limit for Drush commands.

https://git.drupalcode.org/project/memory_limit_policy/-/blob/8.x-1.x/sr...

Kernel request event only works the case of HTTP request (browser/curl). Drush commands very differently, currently there isn't any event that fired at the start of Drush command, introducing an event at beginning of Drush command can an option.

rahul.shinde’s picture

Assigned: Unassigned » rahul.shinde
Issue tags: +#punedrupalgroup, +Drupal India Association
rahul.shinde’s picture

Assigned: rahul.shinde » Unassigned
Status: Active » Needs review
StatusFileSize
new6.39 KB

Adding a new module supporting drush contraints.
Resources that I refered,

sharique’s picture

Status: Needs review » Needs work

Thanks a lot Rahul for posting a patch. Following are my review comments and suggestions.

  • Please mention the minimum version of Drush supported in the description.
  • Also mention the examples for adding command to configurations.
  • It doesn't take Drush alias, for example consider following drush command
    * @command mymodule:doSomething
    * @aliases do-something
    

    It only take mymodule:doSomething but not do-something.

  • It should work with drush aliases.

I'm using Drush version 10.3.1,

rahul.shinde’s picture

Status: Needs work » Needs review
Issue tags: +DIACWOct2020
StatusFileSize
new7.1 KB
new1.91 KB
rahul.shinde’s picture

StatusFileSize
new3.14 KB
new8.44 KB

Uploaded the new patch adding README file.

@Sharique Please review.

sharique’s picture

Status: Needs review » Reviewed & tested by the community

Aliases also working fine now. Thanks Rahul for patch.

vbouchet’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch and the review.

I adapted the code following https://www.drupal.org/project/memory_limit_policy/issues/3185785 but it is a really minor change.

I merged the code in 8.x-1.x branch.

Thanks again for the new feature.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.