Skip to content

Commit bf46a76

Browse files
committed
Merge branch 'master' into 5.6
2 parents 85406b9 + 2f81517 commit bf46a76

File tree

3 files changed

+352
-323
lines changed

3 files changed

+352
-323
lines changed

README.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[![Total Downloads](https://poser.pugx.org/illuminated/console-mutex/downloads)](https://packagist.org/packages/illuminated/console-mutex)
1010
[![License](https://poser.pugx.org/illuminated/console-mutex/license)](https://packagist.org/packages/illuminated/console-mutex)
1111

12-
Prevents overlapping for Laravel console commands.
12+
The mutex for Laravel console commands.
1313

1414
| Laravel | Console Mutex |
1515
| ------- | :----------------------------------------------------------------------: |
@@ -64,10 +64,10 @@ Overlapping can be prevented by various strategies:
6464
- `redis`
6565
- `memcached`
6666

67-
Default `file` strategy is fine for a small applications, which are deployed on a single server.
68-
If your application is more complex and, for example, is deployed on a several nodes, then you probably would like to use some other mutex strategy.
67+
Default `file` strategy is fine for small applications, which are deployed on a single server.
68+
If your application is more complex and deployed on several nodes, then you probably would like to use another mutex strategy.
6969

70-
You can change mutex strategy by specifying `$mutexStrategy` field:
70+
You can change the mutex strategy by specifying `$mutexStrategy` field:
7171

7272
```php
7373
class ExampleCommand extends Command
@@ -102,10 +102,10 @@ class ExampleCommand extends Command
102102

103103
### Set custom timeout
104104

105-
By default mutex is checking for a running command, and if it finds such, it just exits. However, you can manually set
106-
timeout for a mutex, so it can wait for another command to finish it's execution, instead of just quitting immediately.
105+
By default, the mutex is checking for a running command, and if it finds such, it just exits. However, you can manually
106+
set the timeout for a mutex, so it can wait for another command to finish its execution, instead of just quitting immediately.
107107

108-
You can change mutex timeout by specifying `$mutexTimeout` field:
108+
You can change the mutex timeout by specifying `$mutexTimeout` field:
109109

110110
```php
111111
class ExampleCommand extends Command
@@ -140,12 +140,14 @@ There are three possible options for `$mutexTimeout` field:
140140

141141
- `0` - check without waiting (default);
142142
- `{milliseconds}` - check, and wait for a maximum of milliseconds specified;
143-
- `null` - wait, till running command finish it's execution;
143+
- `null` - wait, till running command finish its execution;
144144

145145
### Handle several commands
146146

147-
Sometimes it is useful to set common mutex for a several commands. You can easily achieve this by setting them the same mutex name.
148-
By default, mutex name is generated based on a command's name and arguments. To change this, just override `getMutexName` method in your command:
147+
Sometimes it is useful to set common mutex for several commands. You can easily achieve this by setting them the same mutex name.
148+
By default, mutex name is generated based on a command's name and arguments.
149+
150+
To change this, override `getMutexName` method in your command:
149151
150152
```php
151153
class ExampleCommand extends Command
@@ -163,8 +165,9 @@ class ExampleCommand extends Command
163165
164166
### Custom mutex file storage
165167
166-
If you're using `file` strategy, mutex files will be stored at `storage/app` folder, by default. However, you can change storage
167-
folder by overriding `getMutexFileStorage` method in your command:
168+
If you're using `file` strategy, mutex files will be stored in the `storage/app` folder, by default.
169+
170+
You can change the storage folder by overriding `getMutexFileStorage` method in your command:
168171

169172
```php
170173
class ExampleCommand extends Command
@@ -220,7 +223,8 @@ class ExampleCommand extends Command
220223

221224
### Several traits conflict?
222225

223-
If you're using some other cool `illuminated/console-%` packages, well, then you can find yourself getting "traits conflict".
226+
If you're using another `illuminated/console-%` package, then you can find yourself getting into the "traits conflict".
227+
224228
For example, if you're trying to build [loggable command](https://github.com/dmitry-ivanov/laravel-console-logger), which is protected against overlapping:
225229

226230
```php
@@ -233,10 +237,10 @@ class ExampleCommand extends Command
233237
}
234238
```
235239

236-
You'll get fatal error, the "traits conflict", because both of these traits are overriding `initialize` method:
237-
>If two traits insert a method with the same name, a fatal error is produced, if the conflict is not explicitly resolved.
240+
You'll get the fatal error - the traits conflict, because of both of these traits are overriding `initialize` method:
241+
> If two traits insert a method with the same name, a fatal error is produced, if the conflict is not explicitly resolved.
238242
239-
But don't worry, solution is very simple. Override `initialize` method by yourself, and initialize traits in required order:
243+
Override `initialize` method by yourself, and initialize traits in required order:
240244
241245
```php
242246
class ExampleCommand extends Command

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "illuminated/console-mutex",
3-
"description": "Prevents overlapping for Laravel console commands.",
3+
"description": "The mutex for Laravel console commands.",
44
"keywords": ["laravel", "console", "command", "mutex", "overlapping", "locker"],
55
"license": "MIT",
66
"authors": [

0 commit comments

Comments
 (0)