mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Implemented WebHooks delivery queue.
Completely removed usage of the RabbitMQ. Queue now based on Redis channels. Worker process now extracted as separate docker container. Base image upgraded to the 1.8.0 version (PHP 7.2.7 and pcntl extension).
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use common\components\UserPass;
|
||||
use common\tasks\CreateWebHooksDeliveries;
|
||||
use Yii;
|
||||
use yii\base\InvalidConfigException;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
@@ -152,4 +155,22 @@ class Account extends ActiveRecord {
|
||||
return $this->registration_ip === null ? null : inet_ntop($this->registration_ip);
|
||||
}
|
||||
|
||||
public function afterSave($insert, $changedAttributes) {
|
||||
parent::afterSave($insert, $changedAttributes);
|
||||
|
||||
if ($insert) {
|
||||
return;
|
||||
}
|
||||
|
||||
$meaningfulFields = ['username', 'email', 'uuid', 'status', 'lang'];
|
||||
$meaningfulChangedAttributes = array_filter($changedAttributes, function(string $key) use ($meaningfulFields) {
|
||||
return in_array($key, $meaningfulFields, true);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
if (empty($meaningfulChangedAttributes)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Yii::$app->queue->push(CreateWebHooksDeliveries::createAccountEdit($this, $meaningfulChangedAttributes));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user