Skip to content

Commit

Permalink
use mysql mutex lock mechanism (luyadev#576)
Browse files Browse the repository at this point in the history
* use mysql mutex lock mechanism

* add changelog, upgrade and udpate test cases

* add changelog info
  • Loading branch information
nadar authored and slowfox089 committed Dec 10, 2020
1 parent caec32d commit d6e37c8
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE

## 3.7.0

> This release contains a behavior change where MysqlMutex is default instead of FileMutex. Check the [UPGRADE document](UPGRADE.md) to read more about breaking changes.
+ [#576](https://github.com/luyadev/luya-module-admin/pull/576) Use `MysqlMutex` as default Mutex class for the Admin Queue instead of `FileMutex` due to people have problems with file permissiosn when running the queue in cli mode. MysqlMutex is also the better approach when multiple works might run on different workloads.
+ [#575](https://github.com/luyadev/luya-module-admin/pull/575) New hungarian language option.
+ [#574](https://github.com/luyadev/luya-module-admin/pull/574) Add new toasts design (stronger colors).
+ [#577](https://github.com/luyadev/luya-module-admin/pull/577) Queue Scheduler Job loads only the target attribute into the model.
Expand Down
12 changes: 12 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

This document will help you upgrading from a LUYA admin module version into another. For more detailed informations about the breaking changes **click the issue detail link**, there you can examples of how to change your code.

## from 3.6 to 3.7

+ [#576](https://github.com/luyadev/luya-module-admin/pull/576) Using the `yii\mutex\MysqlMutex` over `yii\mutex\FileMutex` as default mutex handler for admin queue components. This is due to less file permission conflicts when running cli consoles and runtime folder. In order to ensure the old behavior use the configuration below:
```php
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
]
]
```

## from 3.1 to 3.2

+ [#484](https://github.com/luyadev/luya-module-admin/pull/484) Changed `applyFilter()` method signature in class `luya\admin\modles\StorageFilterChain` from `applyFilter($loadFromPath, $imageSavePath)` to `applyFilter(ImageInterface $image, array $saveOptions)`. Since version 3.2 the applyFilter requires an instance of `Imagine\Image\ImageInterface` and returns an array containing two elements, the image object and the saving options. This method is internally used to apply the filter chain and is typically not used in an application. If you are, for some reason, calling this method update to the new signature.
Expand Down
9 changes: 8 additions & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ final class Module extends \luya\admin\base\Module implements CoreModuleInterfac
* @since 2.0.4
*/
public $bootstrapQueueCli = true;

/**
* @var string The mutex class which should be used for the admin queue component. Changed from `yii\mutex\FileMutex` to `yii\mutex\MysqlMutex` as a database connection
* is required in the admin area and there are no conflicts with file permissions when running in cli mode. In order to ensure the old behavior use the FileMutex class.
* @since 3.7.0
*/
public $queueMutexClass = 'yii\mutex\MysqlMutex';

/**
* @var boolean The default value for {{luya\admin\models\StorageFile::$inline_disposition}} when uploading a new file. By default this is display which will force a download
Expand Down Expand Up @@ -550,7 +557,7 @@ public function registerComponents()
'adminqueue' => [
'class' => 'yii\queue\db\Queue',
'db' => 'db',
'mutex' => 'yii\mutex\FileMutex',
'mutex' => $this->queueMutexClass,
'tableName' => 'admin_queue',
'channel' => 'default',
'as log' => 'luya\admin\behaviors\QueueLogBehavior',
Expand Down
1 change: 1 addition & 0 deletions tests/AdminConsoleSqLiteTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function getConfigArray()
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
],
'crudmodulefolderadmin' => [
'class' => 'admintests\data\modules\crudmodulefolder\admin\Module',
Expand Down
1 change: 1 addition & 0 deletions tests/AdminModelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function getConfigArray()
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
],
],
];
Expand Down
1 change: 1 addition & 0 deletions tests/NgRestTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function getConfigArray()
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
],
],
];
Expand Down
1 change: 1 addition & 0 deletions tests/data/configs/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
],
'crudmodulefolderadmin' => [
'class' => 'admintests\data\modules\crudmodulefolder\admin\Module',
Expand Down
1 change: 1 addition & 0 deletions tests/data/configs/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'modules' => [
'admin' => [
'class' => 'luya\admin\Module',
'queueMutexClass' => 'yii\mutex\FileMutex',
],
'crudmodulefolderadmin' => [
'class' => 'admintests\data\modules\crudmodulefolder\admin\Module',
Expand Down

0 comments on commit d6e37c8

Please sign in to comment.