@@ -130,7 +130,7 @@ public function testCheckThatPidFilesWasCreated()
130
130
public function testSpecificConsumerAndRerun ()
131
131
{
132
132
$ specificConsumer = 'quoteItemCleaner ' ;
133
- $ pidFilePath = $ specificConsumer . ConsumersRunner:: PID_FILE_EXT ;
133
+ $ pidFilePath = $ this -> getPidFileName ( $ specificConsumer) ;
134
134
$ config = $ this ->config ;
135
135
$ config ['cron_consumers_runner ' ] = ['consumers ' => [$ specificConsumer ], 'max_messages ' => 0 ];
136
136
@@ -228,7 +228,7 @@ private function writeConfig(array $config)
228
228
private function getPidFileFullPath ($ consumerName )
229
229
{
230
230
$ directoryList = $ this ->objectManager ->get (DirectoryList::class);
231
- return $ directoryList ->getPath (DirectoryList::VAR_DIR ) . '/ ' . $ consumerName . ConsumersRunner:: PID_FILE_EXT ;
231
+ return $ directoryList ->getPath (DirectoryList::VAR_DIR ) . '/ ' . $ this -> getPidFileName ( $ consumerName) ;
232
232
}
233
233
234
234
/**
@@ -239,7 +239,7 @@ protected function tearDown()
239
239
foreach ($ this ->consumerConfig ->getConsumers () as $ consumer ) {
240
240
$ consumerName = $ consumer ->getName ();
241
241
$ pidFileFullPath = $ this ->getPidFileFullPath ($ consumerName );
242
- $ pidFilePath = $ consumerName . ConsumersRunner:: PID_FILE_EXT ;
242
+ $ pidFilePath = $ this -> getPidFileName ( $ consumerName) ;
243
243
$ pid = $ this ->pid ->getPid ($ pidFilePath );
244
244
245
245
if ($ pid && $ this ->pid ->isRun ($ pidFilePath )) {
@@ -258,4 +258,15 @@ protected function tearDown()
258
258
$ this ->writeConfig ($ this ->config );
259
259
$ this ->appConfig ->reinit ();
260
260
}
261
+
262
+ /**
263
+ * @param string $consumerName The consumers name
264
+ * @return string The name to file with PID
265
+ */
266
+ private function getPidFileName ($ consumerName )
267
+ {
268
+ $ sanitizedHostname = preg_replace ('/[^a-z0-9]/i ' , '' , gethostname ());
269
+
270
+ return $ consumerName . '- ' . $ sanitizedHostname . ConsumersRunner::PID_FILE_EXT ;
271
+ }
261
272
}
0 commit comments