2.0.2 (2022-02-15)

- Replace strftime with strtotime for PHP8.1 support
- Added processing class into proc line for easier debugging
This commit is contained in:
Daniel Mason 2022-02-15 09:07:24 +13:00
parent 3d869bf653
commit ac044747aa
5 changed files with 15 additions and 9 deletions

View File

@ -30,8 +30,8 @@ test:7.4:
- docker - docker
# Test PHP 8.0 # Test PHP 8.0
test:8.0: test:8.1:
image: php:8.0 image: php:8.1
before_script: before_script:
- *docker_boostrap - *docker_boostrap
script: script:
@ -41,7 +41,7 @@ test:8.0:
# Codestandards # Codestandards
lint: lint:
image: php:8.0 image: php:8.1
allow_failure: true allow_failure: true
script: script:
- apt update && apt install -y wget unzip git - apt update && apt install -y wget unzip git

View File

@ -1,3 +1,7 @@
## 2.0.2 (2022-02-15)
- Replace strftime with strtotime for PHP8.1 support
- Added processing class into proc line for easier debugging
## 2.0.1 (2022-02-08) ## 2.0.1 (2022-02-08)
- Fixed issue with lingering keys causing constant memory growth - Fixed issue with lingering keys causing constant memory growth
- Add PHP8 support - Add PHP8 support

View File

@ -24,7 +24,7 @@ class ResqueFailureRedis implements ResqueFailureInterface
public function __construct($payload, $exception, $worker, $queue) public function __construct($payload, $exception, $worker, $queue)
{ {
$data = new \stdClass(); $data = new \stdClass();
$data->failed_at = strftime('%a %b %d %H:%M:%S %Z %Y'); $data->failed_at = date('D M d H:i:s T Y');
$data->payload = $payload; $data->payload = $payload;
$data->exception = get_class($exception); $data->exception = get_class($exception);
$data->error = $exception->getMessage(); $data->error = $exception->getMessage();

View File

@ -47,7 +47,7 @@ class Log extends \Psr\Log\AbstractLogger
if (array_search($level, $logLevels) <= array_search($this->logLevel, $logLevels)) { if (array_search($level, $logLevels) <= array_search($this->logLevel, $logLevels)) {
fwrite( fwrite(
STDOUT, STDOUT,
'[' . $level . '][' . strftime('%Y-%m-%d %T') . '] ' . '[' . $level . '][' . date('Y-m-d H:i:s') . '] ' .
$this->interpolate($message, $context) . PHP_EOL $this->interpolate($message, $context) . PHP_EOL
); );
} }

View File

@ -215,7 +215,9 @@ class Worker
// Forked and we're the child. Run the job. // Forked and we're the child. Run the job.
if ($this->child === 0 || $this->child === false) { if ($this->child === 0 || $this->child === false) {
$status = 'Processing ' . $job->queue . ' since ' . strftime('%F %T'); $status = 'Processing ' . $job->queue
. ' (' . ($job->payload['class'] ?? '') . ') since '
. date('Y-m-d H:i:s');
$this->updateProcLine($status); $this->updateProcLine($status);
$this->logger->log(\Psr\Log\LogLevel::INFO, $status); $this->logger->log(\Psr\Log\LogLevel::INFO, $status);
/** @noinspection PhpParamsInspection */ /** @noinspection PhpParamsInspection */
@ -227,7 +229,7 @@ class Worker
if ($this->child > 0) { if ($this->child > 0) {
// Parent process, sit and wait // Parent process, sit and wait
$status = 'Forked ' . $this->child . ' at ' . strftime('%F %T'); $status = 'Forked ' . $this->child . ' at ' . date('Y-m-d H:i:s');
$this->updateProcLine($status); $this->updateProcLine($status);
$this->logger->log(\Psr\Log\LogLevel::INFO, $status); $this->logger->log(\Psr\Log\LogLevel::INFO, $status);
@ -489,7 +491,7 @@ class Worker
public function registerWorker() public function registerWorker()
{ {
Resque::redis()->sadd('workers', (string)$this); Resque::redis()->sadd('workers', (string)$this);
Resque::redis()->setex('worker:' . (string)$this . ':started', 172800, strftime('%a %b %d %H:%M:%S %Z %Y')); Resque::redis()->setex('worker:' . (string)$this . ':started', 172800, date('D M d H:i:s T Y'));
} }
/** /**
@ -522,7 +524,7 @@ class Worker
$job->updateStatus(\Resque\Job\Status::STATUS_RUNNING); $job->updateStatus(\Resque\Job\Status::STATUS_RUNNING);
$data = json_encode([ $data = json_encode([
'queue' => $job->queue, 'queue' => $job->queue,
'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'), 'run_at' => date('D M d H:i:s T Y'),
'payload' => $job->payload 'payload' => $job->payload
]); ]);
Resque::redis()->setex('worker:' . $job->worker, 172800, $data); Resque::redis()->setex('worker:' . $job->worker, 172800, $data);