Skip to content

Commit 975014a

Browse files
authored
Merge pull request #13 from VanOns/feature/configurable-shell-timeout
Configurable shell timeout
2 parents f090731 + 5ce08c9 commit 975014a

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

UPGRADING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ across such a case, please let us know by [opening an issue][issues], or by addi
66

77
## v0.8.0
88

9-
* The namespace for the `AnonymizeUsers` processor has changed. Make sure to update your config file accordingly:
9+
* The namespace for the `AnonymizeUsers` processor was changed. Make sure to update your config file accordingly:
1010

1111
```diff
1212
- \VanOns\LaravelEnvironmentImporter\Processors\AnonymizeUsers::class
1313
+ \VanOns\LaravelEnvironmentImporter\Processors\Data\AnonymizeUsers::class
1414
```
1515

16+
* The `db_timeout` configuration option was added (default: `60`, same as the default shell command timeout).
17+
Set the option to `null` to disable the timeout.
18+
1619
## v0.6.0
1720

18-
* The configuration for the `AnonymizeUsers` processor has changed. Make sure to update your config file accordingly, so
21+
* The configuration for the `AnonymizeUsers` processor was changed. Make sure to update your config file accordingly, so
1922
that it follows the following format:
2023

2124
```php

config/environment-importer.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@
7777

7878
'db_import_binary_path' => env('LEI_DB_IMPORT_BINARY_PATH', '/usr/bin'),
7979

80+
/*
81+
|--------------------------------------------------------------------------
82+
| Database Timeout
83+
|--------------------------------------------------------------------------
84+
|
85+
| Here you can define the timeout (in seconds) for database operations.
86+
| This includes dumping and importing the database.
87+
|
88+
| Set to `null` to disable the timeout.
89+
|
90+
*/
91+
92+
'db_timeout' => env('LEI_DB_TIMEOUT', 60),
93+
8094
/*
8195
|--------------------------------------------------------------------------
8296
| Backup Path

src/Commands/ImportEnvironmentCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ protected function importMysqlDump(string $dumpFile): void
509509

510510
$process = Process::fromShellCommandline($command, env: [
511511
'MYSQL_PWD' => DB::getConfig('password'),
512-
]);
512+
], timeout: $this->getConfigValue('db_timeout'));
513513

514514
$process->run();
515515

@@ -701,7 +701,7 @@ protected function importSingle(string|int $key, string|array $extra): void
701701
);
702702

703703
$progressBar = $this->getOutput()->createProgressBar();
704-
$process = Process::fromShellCommandline($command)->setTimeout(null);
704+
$process = Process::fromShellCommandline($command, timeout: $this->getConfigValue('db_timeout'));
705705
$total = 0;
706706
$current = 0;
707707
$rsyncStart = now();

0 commit comments

Comments
 (0)