summaryrefslogtreecommitdiff
path: root/maintenance/showJobs.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/showJobs.php')
-rw-r--r--maintenance/showJobs.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/maintenance/showJobs.php b/maintenance/showJobs.php
index 1dceb790..8b49517f 100644
--- a/maintenance/showJobs.php
+++ b/maintenance/showJobs.php
@@ -39,21 +39,24 @@ class ShowJobs extends Maintenance {
$this->mDescription = "Show number of jobs waiting in master database";
$this->addOption( 'group', 'Show number of jobs per job type' );
}
+
public function execute() {
- $dbw = wfGetDB( DB_MASTER );
+ $group = JobQueueGroup::singleton();
if ( $this->hasOption( 'group' ) ) {
- $res = $dbw->select(
- 'job',
- array( 'job_cmd', 'count(*) as count' ),
- array(),
- __METHOD__,
- array( 'GROUP BY' => 'job_cmd' )
- );
- foreach ( $res as $row ) {
- $this->output( $row->job_cmd . ': ' . $row->count . "\n" );
+ foreach ( $group->getQueueTypes() as $type ) {
+ $queue = $group->get( $type );
+ $pending = $queue->getSize();
+ $claimed = $queue->getAcquiredCount();
+ if ( ( $pending + $claimed ) > 0 ) {
+ $this->output( "{$type}: $pending queued; $claimed acquired\n" );
+ }
}
} else {
- $this->output( $dbw->selectField( 'job', 'count(*)', '', __METHOD__ ) . "\n" );
+ $count = 0;
+ foreach ( $group->getQueueTypes() as $type ) {
+ $count += $group->get( $type )->getSize();
+ }
+ $this->output( "$count\n" );
}
}
}