From 0307cb3e785ac350ebf060ca3e18cabda3619da2 Mon Sep 17 00:00:00 2001 From: Qi HU Date: Thu, 18 Dec 2025 13:09:54 +0800 Subject: [PATCH 1/2] 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, ], From b921beffd705a2a35be8489afd39f7b47d1e43c2 Mon Sep 17 00:00:00 2001 From: Qi HU Date: Thu, 18 Dec 2025 13:35:05 +0800 Subject: [PATCH 2/2] Enable IYUU PTGen v2.0.0 Signed-off-by: Qi HU --- nexus/PTGen/PTGen.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/nexus/PTGen/PTGen.php b/nexus/PTGen/PTGen.php index 8c459456..4b208fbd 100644 --- a/nexus/PTGen/PTGen.php +++ b/nexus/PTGen/PTGen.php @@ -350,9 +350,17 @@ HTML; public function isIyuu(array $bodyArr): bool { - return false; - //Not support, due to change frequently -// return isset($bodyArr['ret']) && $bodyArr['ret'] == 200; + $version = (string)($bodyArr['version'] ?? ''); + switch ($version) { + case '2.0.0': + return isset($bodyArr['ret']) + && intval($bodyArr['ret']) === 200 + && isset($bodyArr['data']['format']) + && is_string($bodyArr['data']['format']) + && $bodyArr['data']['format'] !== ''; + default: + return false; + } } public function listRatings(array $ptGenData, string $imdbLink, string $desc = ''): array @@ -574,6 +582,10 @@ HTML; do_log("$log, site: $site can not be updated: " . $exception->getMessage(), 'error'); } } + if (empty($ptGenInfo)) { + do_log("$log, no pt gen info updated"); + return false; + } $siteIdAndRating = $this->listRatings($ptGenInfo, $torrent->url, $extra->descr); foreach ($siteIdAndRating as $key => $value) { if (!isset($ptGenInfo[$key]['data']) || !is_array($ptGenInfo[$key]['data'])) {