Skip to content

Commit

Permalink
fix Cleanup runBatchJob
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Jul 24, 2023
1 parent 308cc93 commit d393d83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions app/Repositories/CleanupRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,16 @@ private static function runBatchJob($batchKey, $requestId)
/* Don't ever return an empty array until we're done iterating */
$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_RETRY);
while($arr_keys = $redis->hScan($batch, $it, "*", self::$scanSize)) {
foreach($arr_keys as $k => $v) {
$delay = self::getDelay($batchKeyInfo['task_index'], $length, $page);
$idStr = implode(",", array_keys($arr_keys));
$command = sprintf(
'cleanup --action=%s --begin_id=%s --end_id=%s --id_str=%s --request_id=%s --delay=%s',
$batchKeyInfo['action'], 0, 0, $idStr, $requestId, $delay
);
$output = executeCommand($command, 'string', true);
do_log(sprintf('command: %s, output: %s', $command, $output));
$page++;
$count += count($arr_keys);
}
$delay = self::getDelay($batchKeyInfo['task_index'], $length, $page);
$idStr = implode(",", array_keys($arr_keys));
$command = sprintf(
'cleanup --action=%s --begin_id=%s --end_id=%s --id_str=%s --request_id=%s --delay=%s',
$batchKeyInfo['action'], 0, 0, $idStr, $requestId, $delay
);
$output = executeCommand($command, 'string', true);
do_log(sprintf('command: %s, output: %s', $command, $output));
$count += count($arr_keys);
$page++;
}

//remove this batch
Expand Down
2 changes: 1 addition & 1 deletion include/constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.5');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-07-22');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-07-24');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
Expand Down

0 comments on commit d393d83

Please sign in to comment.