9
9
*/
10
10
namespace Magento \Cron \Observer ;
11
11
12
+ use Laminas \Http \PhpEnvironment \Request ;
12
13
use Magento \Cron \Model \ResourceModel \Schedule \Collection as ScheduleCollection ;
13
14
use Magento \Cron \Model \Schedule ;
14
15
use Magento \Framework \App \State ;
@@ -128,6 +129,16 @@ class ProcessCronQueueObserver implements ObserverInterface
128
129
*/
129
130
protected $ dateTime ;
130
131
132
+ /**
133
+ * @var Request
134
+ */
135
+ protected Request $ environment ;
136
+
137
+ /**
138
+ * @var string
139
+ */
140
+ protected string $ originalProcessTitle ;
141
+
131
142
/**
132
143
* @var \Symfony\Component\Process\PhpExecutableFinder
133
144
*/
@@ -201,7 +212,8 @@ public function __construct(
201
212
StatFactory $ statFactory ,
202
213
\Magento \Framework \Lock \LockManagerInterface $ lockManager ,
203
214
\Magento \Framework \Event \ManagerInterface $ eventManager ,
204
- DeadlockRetrierInterface $ retrier
215
+ DeadlockRetrierInterface $ retrier ,
216
+ Request $ environment
205
217
) {
206
218
$ this ->_objectManager = $ objectManager ;
207
219
$ this ->_scheduleFactory = $ scheduleFactory ;
@@ -211,6 +223,7 @@ public function __construct(
211
223
$ this ->_request = $ request ;
212
224
$ this ->_shell = $ shell ;
213
225
$ this ->dateTime = $ dateTime ;
226
+ $ this ->environment = $ environment ;
214
227
$ this ->phpExecutableFinder = $ phpExecutableFinderFactory ->create ();
215
228
$ this ->logger = $ logger ;
216
229
$ this ->state = $ state ;
@@ -339,7 +352,17 @@ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule,
339
352
);
340
353
}
341
354
342
- cli_set_process_title ("Magento cron - group= $ groupId - job= $ jobCode " );
355
+ if (!isset ($ this ->originalProcessTitle )) {
356
+ $ this ->originalProcessTitle = implode (' ' , $ this ->environment ->getServer ('argv ' ));
357
+ }
358
+
359
+ if (strpos ($ this ->originalProcessTitle , " --group= $ groupId " ) !== false ) {
360
+ // Group is already shown, so no need to include here in duplicate
361
+ cli_set_process_title ($ this ->originalProcessTitle . " # job: $ jobCode " );
362
+ } else {
363
+ cli_set_process_title ($ this ->originalProcessTitle . " # group: $ groupId, job: $ jobCode " );
364
+ }
365
+
343
366
$ schedule ->setExecutedAt (strftime ('%Y-%m-%d %H:%M:%S ' , $ this ->dateTime ->gmtTimestamp ()));
344
367
$ this ->retrier ->execute (
345
368
function () use ($ schedule ) {
0 commit comments