chrisboulton / php-resque

PHP port of resque (Workers and Queueing)
MIT License
3.43k stars 759 forks source link

use a variable to store process name prefix #337

Closed Hikariii closed 2 years ago

Hikariii commented 7 years ago

This variable removes the magic string, allowing specification through hooks. In our own environment we run this code beforeFirstFork:

$worker::$processPrefix = sprintf('%s%s-', $worker::$processPrefix, $prefix);

We like to be able to see environment differences in top and ps a because we have different users running different instances on the same server.

chrisboulton commented 7 years ago

This is a good change, especially if you have some kind of shared infrastructure with multiple apps. 👍

I think rather than a variable here, it might make sense to have this as a setter method - either keeping it as static, or allow it to dynamically be set on an instantiated worker. My argument for an explicit setter method is it means the underlying implementation in Resque can change and the contract we have for consumers doesn't need to be updated. Would you mind updating your PR with that?