diff --git a/app/Console/Commands/AutoUpdateUserLastActions.php b/app/Console/Commands/AutoUpdateUserLastActions.php index 7ca01cb3a6..cad268c369 100644 --- a/app/Console/Commands/AutoUpdateUserLastActions.php +++ b/app/Console/Commands/AutoUpdateUserLastActions.php @@ -49,7 +49,7 @@ final public function handle(): void $userIdCount = Redis::command('LLEN', [$key]); - $userIds = Redis::command('LPOP', [$key, $userIdCount]); + $userIds = Redis::command('LRANGE', [$key, 0, $userIdCount - 1]); if ($userIds !== false) { DB::transaction(static function () use ($userIds): void { @@ -61,6 +61,8 @@ final public function handle(): void }, 5); } + Redis::command('LTRIM', [$key, $userIdCount, -1]); + $this->comment('Automated upsert histories command complete'); } } diff --git a/app/Console/Commands/AutoUpsertHistories.php b/app/Console/Commands/AutoUpsertHistories.php index 1f5cdf3d5a..541939ec40 100644 --- a/app/Console/Commands/AutoUpsertHistories.php +++ b/app/Console/Commands/AutoUpsertHistories.php @@ -73,7 +73,7 @@ final public function handle(): void $historyCount = Redis::connection('announce')->command('LLEN', [$key]); for ($historiesLeft = $historyCount; $historiesLeft > 0; $historiesLeft -= $historiesPerCycle) { - $histories = Redis::connection('announce')->command('LPOP', [$key, $historiesPerCycle]); + $histories = Redis::connection('announce')->command('LRANGE', [$key, 0, $historiesPerCycle - 1]); if ($histories === false) { break; @@ -103,6 +103,8 @@ final public function handle(): void ], ); }, 5); + + Redis::connection('announce')->command('LTRIM', [$key, $historiesPerCycle, -1]); } $this->comment('Automated upsert histories command complete'); diff --git a/app/Console/Commands/AutoUpsertPeers.php b/app/Console/Commands/AutoUpsertPeers.php index 31caeb7405..9f99db925a 100644 --- a/app/Console/Commands/AutoUpsertPeers.php +++ b/app/Console/Commands/AutoUpsertPeers.php @@ -57,7 +57,7 @@ final public function handle(): void $peerCount = Redis::connection('announce')->command('LLEN', [$key]); for ($peersLeft = $peerCount; $peersLeft > 0; $peersLeft -= $peerPerCycle) { - $peers = Redis::connection('announce')->command('LPOP', [$key, $peerPerCycle]); + $peers = Redis::connection('announce')->command('LRANGE', [$key, 0, $peerPerCycle - 1]); if ($peers === false) { break; @@ -86,6 +86,8 @@ final public function handle(): void ], ); }, 5); + + Redis::connection('announce')->command('LTRIM', [$key, $peerPerCycle, -1]); } $this->comment('Automated insert peers command complete');