Score:0

How to change TIMEOUT for Drush command

us flag

I am working on a website with an extremely heavy database.

As a result, the command drush sql-cli < [db_filename] takes more than default value of 14400 seconds.

I need to find a way how to change this value properly.

I found put that the function I need is setTimeout() from the vendor/symfony/process/Process.php.
I can use it directly in vendor/drush/drush/src/Commands/sql/SqlCommands.php like this:

public function cli(InputInterface $input, $options = ['extra' => self::REQ])
    {
        $sql = SqlBase::create($options);
        $process = $this->processManager()->shell($sql->connect(), null, $sql->getEnv());

        // Set timeout here.
        $process->setTimeout(36000);

        if (!Tty::isTtySupported()) {
            $process->setInput($this->stdin()->getStream());
        } else {
            $process->setTty($this->getConfig()->get('ssh.tty', $input->isInteractive()));
        }
        $process->mustRun($process->showRealtime());
    }

However, I do not want to touch the vendor folder, I think that the better solution is to write a hook or to alter an existing functionality any other way in Drupal module.
But I cannot understand how it can be done.

Could you please give me an advice on how to do this?

Edit
I know that I can create a patch and include it in composer.json of the project.
However, I would like to know if a better way exists.

id flag
I am not sure what kind of answer we could provide here that would not require modifying Drush or you providing less input data. These have been discussed with the Drush maintainers https://github.com/drush-ops/drush/issues/4716. I think your choices are patch Drush, advocate for this feature in Drush, limit the input, or import the database another way.
Sergey avatar
us flag
@cilefen Thank you for the opinion. I will consider this.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.