File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/Illuminate/Queue/Console Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ class MonitorCommand extends Command
19
19
*/
20
20
protected $ signature = 'queue:monitor
21
21
{queues : The names of the queues to monitor}
22
- {--max=1000 : The maximum number of jobs that can be on the queue before an event is dispatched} ' ;
22
+ {--max=1000 : The maximum number of jobs that can be on the queue before an event is dispatched}
23
+ {--json : Output the queue size as JSON} ' ;
23
24
24
25
/**
25
26
* The console command description.
@@ -65,7 +66,15 @@ public function handle()
65
66
{
66
67
$ queues = $ this ->parseQueues ($ this ->argument ('queues ' ));
67
68
68
- $ this ->displaySizes ($ queues );
69
+ if ($ this ->option ('json ' )) {
70
+ $ this ->output ->writeln ((new Collection ($ queues ))->map (function ($ queue ) {
71
+ return array_merge ($ queue , [
72
+ 'status ' => str_contains ($ queue ['status ' ], 'ALERT ' ) ? 'ALERT ' : 'OK ' ,
73
+ ]);
74
+ })->toJson ());
75
+ } else {
76
+ $ this ->displaySizes ($ queues );
77
+ }
69
78
70
79
$ this ->dispatchEvents ($ queues );
71
80
}
You can’t perform that action at this time.
0 commit comments