From 0307cb3e785ac350ebf060ca3e18cabda3619da2 Mon Sep 17 00:00:00 2001 From: Qi HU Date: Thu, 18 Dec 2025 13:09:54 +0800 Subject: [PATCH] Tune seed bonus job batch and timeouts Signed-off-by: Qi HU --- app/Jobs/CalculateUserSeedBonus.php | 3 ++- app/Repositories/CleanupRepository.php | 2 +- config/horizon.php | 2 +- config/queue.php | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Jobs/CalculateUserSeedBonus.php b/app/Jobs/CalculateUserSeedBonus.php index afdf998b..60ad4fba 100644 --- a/app/Jobs/CalculateUserSeedBonus.php +++ b/app/Jobs/CalculateUserSeedBonus.php @@ -47,7 +47,7 @@ class CalculateUserSeedBonus implements ShouldQueue public $tries = 1; - public $timeout = 3600; + public $timeout = 120; /** * 获取任务时,应该通过的中间件。 @@ -72,6 +72,7 @@ class CalculateUserSeedBonus implements ShouldQueue $this->requestId, $this->beginUid, $this->endUid, $this->idStr, $this->idRedisKey ); do_log("$logPrefix, job start ..."); + $haremAdditionFactor = Setting::get('bonus.harem_addition'); $officialAdditionFactor = Setting::get('bonus.official_addition'); $donortimes_bonus = Setting::get('bonus.donortimes'); diff --git a/app/Repositories/CleanupRepository.php b/app/Repositories/CleanupRepository.php index 3f7b075a..f1c8fbef 100644 --- a/app/Repositories/CleanupRepository.php +++ b/app/Repositories/CleanupRepository.php @@ -37,7 +37,7 @@ class CleanupRepository extends BaseRepository private static int $oneTaskSeconds = 0; - private static int $scanSize = 1000; + private static int $scanSize = 500; public static function recordBatch(\Redis $redis, $uid, $torrentId) { diff --git a/config/horizon.php b/config/horizon.php index 51719726..d1afd506 100644 --- a/config/horizon.php +++ b/config/horizon.php @@ -191,7 +191,7 @@ return [ 'maxJobs' => 0, 'memory' => 128, 'tries' => 1, - 'timeout' => 600, + 'timeout' => 120, 'nice' => 0, ], ], diff --git a/config/queue.php b/config/queue.php index 3d29f3af..9d8bf8eb 100644 --- a/config/queue.php +++ b/config/queue.php @@ -66,7 +66,7 @@ return [ 'driver' => 'redis', 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'nexus_queue'), - 'retry_after' => 90, + 'retry_after' => 150, 'block_for' => null, 'after_commit' => true, ],