From 1cdc04e8efaba498e61f0c7db37c991d9649d86f Mon Sep 17 00:00:00 2001 From: vasya Date: Sun, 29 Mar 2026 20:41:06 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F?= =?UTF-8?q?=D1=8E=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20?= =?UTF-8?q?redis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/cache.php | 4 ++-- config/database.php | 34 ++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/config/cache.php b/config/cache.php index b32aead..744f620 100644 --- a/config/cache.php +++ b/config/cache.php @@ -74,8 +74,8 @@ return [ 'redis' => [ 'driver' => 'redis', - 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), - 'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'), + 'connection' => 'cache', + 'lock_connection' => 'default', ], 'dynamodb' => [ diff --git a/config/database.php b/config/database.php index df933e7..1aa3144 100644 --- a/config/database.php +++ b/config/database.php @@ -138,7 +138,7 @@ return [ | | Redis is an open source, fast, and advanced key-value store that also | provides a richer body of commands than a typical key-value system - | such as Memcached. You may define your connection settings here. + | such as APC or Memcached. Laravel makes it easy to dig right in. | */ @@ -148,8 +148,9 @@ return [ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'), - 'persistent' => env('REDIS_PERSISTENT', false), + //'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + //Нижний прочерк нужен, чтобы отделить платформу_модуль от сущность:id:значение. Если после нижнего прочерка ничего нет, значение было установлено из "корня" платформы + 'prefix' => env('REDIS_PREFIX', 'uknown|'), ], 'default' => [ @@ -159,10 +160,6 @@ return [ 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), - 'max_retries' => env('REDIS_MAX_RETRIES', 3), - 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'), - 'backoff_base' => env('REDIS_BACKOFF_BASE', 100), - 'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000), ], 'cache' => [ @@ -171,13 +168,26 @@ return [ 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), - 'database' => env('REDIS_CACHE_DB', '1'), - 'max_retries' => env('REDIS_MAX_RETRIES', 3), - 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'), - 'backoff_base' => env('REDIS_BACKOFF_BASE', 100), - 'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000), + 'database' => '1', ], + 'queue' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'port' => env('REDIS_PORT', '6379'), + 'database' => '2', + ], + + 'notifications' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'port' => env('REDIS_PORT', '6379'), + 'database' => '3', + ], ], ]; -- 2.52.0 From 184629d15bd3fe8906667f06aba836b80a9962d4 Mon Sep 17 00:00:00 2001 From: vasya Date: Sat, 11 Apr 2026 22:40:34 +0300 Subject: [PATCH 2/4] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B8=20=D0=BE=D1=80=D0=B3?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D1=83=20=D1=81=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D1=83=D1=81=D0=BA=D0=BE=D0=BC=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5?= =?UTF-8?q?=D1=81=D1=81=D0=BE=D0=B2=20=D0=BF=D0=BE=20=D1=80=D0=B0=D1=81?= =?UTF-8?q?=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B8=D1=8E.=20=D0=9F=D0=BE?= =?UTF-8?q?=D0=BD=D0=B8=D0=BC=D0=B0=D1=8E,=20=D1=87=D1=82=D0=BE=20=D1=8D?= =?UTF-8?q?=D1=82=D0=BE=20=D0=BD=D0=B5=20=D1=81=D0=BE=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D0=BC=20=D0=BD=D0=B5=20redis,=20=D0=BD=D0=BE=20=D0=BF=D0=BE=20?= =?UTF-8?q?=D1=81=D0=BC=D1=8B=D1=81=D0=BB=D1=83=20=D0=B1=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=BA=D0=BE,=20=D0=B0=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20=D0=B2=D0=B5=D1=82=D0=BA=D1=83=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=B4=20=D0=B5=D0=B4=D0=B8=D0=BD=D1=81=D1=82=D0=B2=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D0=B9=D1=8B=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF?= =?UTF-8?q?=D1=82=20=D0=BD=D0=B5=20=D1=85=D0=BE=D1=82=D0=B5=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/BaseScheduleCommand.php | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 app/Console/Commands/BaseScheduleCommand.php diff --git a/app/Console/Commands/BaseScheduleCommand.php b/app/Console/Commands/BaseScheduleCommand.php new file mode 100644 index 0000000..0b9e279 --- /dev/null +++ b/app/Console/Commands/BaseScheduleCommand.php @@ -0,0 +1,48 @@ +logExecErr($th); + } + } + + + /** + * Метод логирования ошибки выполнения скриптов по расписанию + * + * @param \Throwable $th + * @return void + */ + private function logExecErr(\Throwable $th): void + { + $context = [ + //Скрипт откуда запустилась задача + 'command' => static::class, + //Скрипт, в котором произошла ошибка + 'file' => $th->getFile(), + 'line' => $th->getLine(), + ]; + \Log::channel('schedule_err')->error($th->getMessage(), $context); + } +} -- 2.52.0 From ef388bfa2a99d1a03ef5ccb9f2ae122d60793921 Mon Sep 17 00:00:00 2001 From: vasya Date: Sat, 11 Apr 2026 22:47:34 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D0=B1=D0=B0=D0=B7=D0=BE=D0=B2=D1=8B=D0=B9?= =?UTF-8?q?=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20=D0=B4=D0=BB=D1=8F=20Job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Job/BaseJob.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 app/Job/BaseJob.php diff --git a/app/Job/BaseJob.php b/app/Job/BaseJob.php new file mode 100644 index 0000000..323a04e --- /dev/null +++ b/app/Job/BaseJob.php @@ -0,0 +1,39 @@ + static::class, + //Скрипт, в котором произошла ошибка + 'file' => $th->getFile(), + 'line' => $th->getLine(), + ]; + \Log::channel('job_err')->error($th->getMessage(), $context); + } + +} + -- 2.52.0 From 8a371d05b0f202e33e7a4ef1a3c129135408c6dc Mon Sep 17 00:00:00 2001 From: vasya Date: Sat, 11 Apr 2026 22:50:52 +0300 Subject: [PATCH 4/4] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20redis,=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B8=20=D1=81=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20SOLID=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Faceds/RedisNotifications.php | 15 +++++ app/Providers/RedisNotificationProvider.php | 30 ++++++++++ config/queue.php | 62 ++++++++------------- 3 files changed, 67 insertions(+), 40 deletions(-) create mode 100644 app/Faceds/RedisNotifications.php create mode 100644 app/Providers/RedisNotificationProvider.php diff --git a/app/Faceds/RedisNotifications.php b/app/Faceds/RedisNotifications.php new file mode 100644 index 0000000..99ccb59 --- /dev/null +++ b/app/Faceds/RedisNotifications.php @@ -0,0 +1,15 @@ +app->bind(RedisNotificationService::class, function($app){ + return new RedisNotificationService; + }); + } + + /** + * Bootstrap services. + */ + public function boot(): void + { + // + } +} diff --git a/config/queue.php b/config/queue.php index 79c2c0a..7d6a02a 100644 --- a/config/queue.php +++ b/config/queue.php @@ -7,25 +7,24 @@ return [ | Default Queue Connection Name |-------------------------------------------------------------------------- | - | Laravel's queue supports a variety of backends via a single, unified - | API, giving you convenient access to each backend using identical - | syntax for each. The default queue connection is defined below. + | Laravel's queue API supports an assortment of back-ends via a single + | API, giving you convenient access to each back-end using the same + | syntax for every one. Here you may define a default connection. | */ - 'default' => env('QUEUE_CONNECTION', 'database'), + 'default' => env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- | Queue Connections |-------------------------------------------------------------------------- | - | Here you may configure the connection options for every queue backend - | used by your application. An example configuration is provided for - | each backend supported by Laravel. You're also free to add more. + | Here you may configure the connection information for each server that + | is used by your application. A default configuration has been added + | for each back-end shipped with Laravel. You are free to add more. | - | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", - | "deferred", "background", "failover", "null" + | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" | */ @@ -37,18 +36,17 @@ return [ 'database' => [ 'driver' => 'database', - 'connection' => env('DB_QUEUE_CONNECTION'), - 'table' => env('DB_QUEUE_TABLE', 'jobs'), - 'queue' => env('DB_QUEUE', 'default'), - 'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90), + 'table' => 'jobs', + 'queue' => 'default', + 'retry_after' => 90, 'after_commit' => false, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', - 'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'), - 'queue' => env('BEANSTALKD_QUEUE', 'default'), - 'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90), + 'host' => 'localhost', + 'queue' => 'default', + 'retry_after' => 90, 'block_for' => 0, 'after_commit' => false, ], @@ -64,31 +62,17 @@ return [ 'after_commit' => false, ], + #Гаврилов + //ЗАЧЕМ ЭТОТ КОНФИГ? В .ENV НЕТ ПАРАМЕТРА REDIS_QUEUE 'redis' => [ 'driver' => 'redis', - 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), + 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90), + 'retry_after' => 90, 'block_for' => null, 'after_commit' => false, ], - 'deferred' => [ - 'driver' => 'deferred', - ], - - 'background' => [ - 'driver' => 'background', - ], - - 'failover' => [ - 'driver' => 'failover', - 'connections' => [ - 'database', - 'deferred', - ], - ], - ], /* @@ -103,7 +87,7 @@ return [ */ 'batching' => [ - 'database' => env('DB_CONNECTION', 'sqlite'), + 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'job_batches', ], @@ -113,16 +97,14 @@ return [ |-------------------------------------------------------------------------- | | These options configure the behavior of failed queue job logging so you - | can control how and where failed jobs are stored. Laravel ships with - | support for storing failed jobs in a simple file or in a database. - | - | Supported drivers: "database-uuids", "dynamodb", "file", "null" + | can control which database and table are used to store the jobs that + | have failed. You may change them to any database / table you wish. | */ 'failed' => [ 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), - 'database' => env('DB_CONNECTION', 'sqlite'), + 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], -- 2.52.0