From bb75dab93a639b5fabb1f13b587c22719be95da8 Mon Sep 17 00:00:00 2001 From: Josh Richards Date: Fri, 25 Aug 2023 09:20:27 -0400 Subject: [PATCH 1/5] (enh) Change occ background-job:list limit default 10->100 The default limit of 10 seems too conservative. Nearly all environments >100 and most <10. At the same time, this higher default limit still remains reasonable to avoid problems in really big environments. Signed-off-by: Josh Richards --- core/Command/Background/ListCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php index a7b98a037a8..0ba2b8a2194 100644 --- a/core/Command/Background/ListCommand.php +++ b/core/Command/Background/ListCommand.php @@ -53,7 +53,7 @@ class ListCommand extends Base { 'l', InputOption::VALUE_OPTIONAL, 'Number of jobs to retrieve', - '10' + '100' )->addOption( 'offset', 'o', @@ -67,6 +67,7 @@ class ListCommand extends Base { protected function execute(InputInterface $input, OutputInterface $output): int { $jobs = $this->jobList->getJobsIterator($input->getOption('class'), (int)$input->getOption('limit'), (int)$input->getOption('offset')); + $output->writeln("Output is currently limited to first " . $input->getOption('limit') . " jobs. Specify `-l, --limit[=LIMIT]` to override."); $this->writeTableInOutputFormat($input, $output, $this->formatJobs($jobs)); return 0; } From deb4bb8d4e59258f1fb0a7fcfe27173633e580b6 Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 14 Nov 2023 15:58:12 +0100 Subject: [PATCH 2/5] Update core/Command/Background/ListCommand.php Co-authored-by: Daniel Signed-off-by: Jonas --- core/Command/Background/ListCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php index 0ba2b8a2194..44ae72c2c9b 100644 --- a/core/Command/Background/ListCommand.php +++ b/core/Command/Background/ListCommand.php @@ -67,7 +67,9 @@ class ListCommand extends Base { protected function execute(InputInterface $input, OutputInterface $output): int { $jobs = $this->jobList->getJobsIterator($input->getOption('class'), (int)$input->getOption('limit'), (int)$input->getOption('offset')); - $output->writeln("Output is currently limited to first " . $input->getOption('limit') . " jobs. Specify `-l, --limit[=LIMIT]` to override."); + if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { + $output->writeln("Output is currently limited to first " . $input->getOption('limit') . " jobs. Specify `-l, --limit[=LIMIT]` to override."); + } $this->writeTableInOutputFormat($input, $output, $this->formatJobs($jobs)); return 0; } From 9fbe68ab36db626fc2a11dd5a606c53bd3dbd70e Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 14 Nov 2023 16:07:49 +0100 Subject: [PATCH 3/5] fix(Background): Show comment about limit at end and conditionally * Only print the comment when job list is truncated * Show the comment at the end so users actually see it * Format the comment as comment Signed-off-by: Jonas --- core/Command/Background/ListCommand.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php index 44ae72c2c9b..a2588112524 100644 --- a/core/Command/Background/ListCommand.php +++ b/core/Command/Background/ListCommand.php @@ -66,11 +66,12 @@ class ListCommand extends Base { } protected function execute(InputInterface $input, OutputInterface $output): int { - $jobs = $this->jobList->getJobsIterator($input->getOption('class'), (int)$input->getOption('limit'), (int)$input->getOption('offset')); - if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) { - $output->writeln("Output is currently limited to first " . $input->getOption('limit') . " jobs. Specify `-l, --limit[=LIMIT]` to override."); + $limit = (int)$input->getOption('limit'); + $jobsInfo = $this->formatJobs($this->jobList->getJobsIterator($input->getOption('class'), $limit, (int)$input->getOption('offset'))); + $this->writeTableInOutputFormat($input, $output, $jobsInfo); + if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN && count($jobsInfo) >= $limit) { + $output->writeln("\nOutput is currently limited to first " . $limit . " jobs. Specify `-l, --limit[=LIMIT]` to override."); } - $this->writeTableInOutputFormat($input, $output, $this->formatJobs($jobs)); return 0; } From 490f5cc4ec5add02c422ab52b49d4a1b644b80d6 Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 14 Nov 2023 16:45:37 +0100 Subject: [PATCH 4/5] fix(Background): Bump default limit for listing background jobs to 500 Signed-off-by: Jonas --- core/Command/Background/ListCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php index a2588112524..4d5329ec22f 100644 --- a/core/Command/Background/ListCommand.php +++ b/core/Command/Background/ListCommand.php @@ -53,7 +53,7 @@ class ListCommand extends Base { 'l', InputOption::VALUE_OPTIONAL, 'Number of jobs to retrieve', - '100' + '500' )->addOption( 'offset', 'o', From af4287d8a37ef216975df242faa81a22277d4306 Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 14 Nov 2023 21:04:16 +0100 Subject: [PATCH 5/5] Update core/Command/Background/ListCommand.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Jonas --- core/Command/Background/ListCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Command/Background/ListCommand.php b/core/Command/Background/ListCommand.php index 4d5329ec22f..ef5b478a197 100644 --- a/core/Command/Background/ListCommand.php +++ b/core/Command/Background/ListCommand.php @@ -70,7 +70,7 @@ class ListCommand extends Base { $jobsInfo = $this->formatJobs($this->jobList->getJobsIterator($input->getOption('class'), $limit, (int)$input->getOption('offset'))); $this->writeTableInOutputFormat($input, $output, $jobsInfo); if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN && count($jobsInfo) >= $limit) { - $output->writeln("\nOutput is currently limited to first " . $limit . " jobs. Specify `-l, --limit[=LIMIT]` to override."); + $output->writeln("\nOutput is currently limited to " . $limit . " jobs. Specify `-l, --limit[=LIMIT]` to override."); } return 0; }