mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 05:00:49 +08:00
set cleanup batch ttl
This commit is contained in:
@@ -64,6 +64,9 @@ class UpdateTorrentSeedersEtc implements ShouldQueue
|
||||
|
||||
$torrentIdArr = explode(",", $this->idStr);
|
||||
foreach ($torrentIdArr as $torrentId) {
|
||||
if ($torrentId <= 0) {
|
||||
continue;
|
||||
}
|
||||
$peerResult = NexusDB::table('peers')
|
||||
->where('torrent', $torrentId)
|
||||
->selectRaw("count(*) as count, seeder")
|
||||
|
||||
@@ -65,6 +65,9 @@ class UpdateUserSeedingLeechingTime implements ShouldQueue
|
||||
$count = 0;
|
||||
$uidArr = explode(",", $this->idStr);
|
||||
foreach ($uidArr as $uid) {
|
||||
if ($uid <= 0) {
|
||||
continue;
|
||||
}
|
||||
$sumInfo = NexusDB::table('snatched')
|
||||
->selectRaw('sum(seedtime) as seedtime_sum, sum(leechtime) as leechtime_sum')
|
||||
->where('userid', $uid)
|
||||
|
||||
@@ -12,6 +12,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 KEY_LIFETIME = 3600*3;
|
||||
|
||||
private static array $batchKeyActionsMap = [
|
||||
self::USER_SEED_BONUS_BATCH_KEY => [
|
||||
'action' => 'seed_bonus',
|
||||
@@ -79,7 +81,11 @@ class CleanupRepository extends BaseRepository
|
||||
return;
|
||||
}
|
||||
//update the batch key
|
||||
$redis->set($batchKey, $batchKey . ":" . self::getHashKeySuffix());
|
||||
$newBatch = $batchKey . ":" . self::getHashKeySuffix();
|
||||
$redis->set($batchKey, $newBatch, ['ex' => self::KEY_LIFETIME]);
|
||||
$redis->hSetNx($newBatch, -1, 1);
|
||||
$redis->expire($newBatch, self::KEY_LIFETIME);
|
||||
|
||||
|
||||
$count = 0;
|
||||
$it = NULL;
|
||||
@@ -95,7 +101,7 @@ class CleanupRepository extends BaseRepository
|
||||
$batchKeyInfo['action'], 0, 0, $idStr, $requestId, $delay
|
||||
);
|
||||
$output = executeCommand($command, 'string', true);
|
||||
do_log(sprintf('command: %s, output: %s', $command, $output));
|
||||
do_log(sprintf('output: %s', $output));
|
||||
$count += count($arr_keys);
|
||||
$page++;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.5');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-07-24');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-07-25');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
Reference in New Issue
Block a user