From 288b141c43c7348b4c05317d5ff85a39109b0ebc Mon Sep 17 00:00:00 2001 From: lgb <353856593@qq.com> Date: Thu, 22 Feb 2024 12:25:02 +0800 Subject: [PATCH] add prefix to cleanup batch job ids key --- app/Repositories/CleanupRepository.php | 4 +++- include/constants.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Repositories/CleanupRepository.php b/app/Repositories/CleanupRepository.php index 4032b792..bec647cb 100644 --- a/app/Repositories/CleanupRepository.php +++ b/app/Repositories/CleanupRepository.php @@ -13,6 +13,8 @@ class CleanupRepository extends BaseRepository const USER_SEEDING_LEECHING_TIME_BATCH_KEY = "batch_key:user_seeding_leeching_time"; const TORRENT_SEEDERS_ETC_BATCH_KEY = "batch_key:torrent_seeders_etc"; + const IDS_KEY_PREFIX = "cleanup_batch_job_ids:"; + private static array $batchKeyActionsMap = [ self::USER_SEED_BONUS_BATCH_KEY => [ 'action' => 'seed_bonus', @@ -96,7 +98,7 @@ class CleanupRepository extends BaseRepository while($arr_keys = $redis->hScan($batch, $it, "*", self::$scanSize)) { $delay = self::getDelay($batchKeyInfo['task_index'], $length, $page); $idStr = implode(",", array_keys($arr_keys)); - $idRedisKey = Str::random(); + $idRedisKey = self::IDS_KEY_PREFIX + Str::random(); NexusDB::cache_put($idRedisKey, $idStr); $command = sprintf( 'cleanup --action=%s --begin_id=%s --end_id=%s --id_redis_key=%s --request_id=%s --delay=%s', diff --git a/include/constants.php b/include/constants.php index 79698ab7..d7f50f95 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@