Merge branch 'dev-2.0.2' into 'master'

2.0.2 (2022-02-15)

See merge request idanoo/php-resque!2
This commit is contained in:
Daniel Mason 2022-02-14 21:36:34 +00:00
commit 655273ce78
5 changed files with 15 additions and 9 deletions

View File

@ -30,8 +30,8 @@ test:7.4:
- docker
# Test PHP 8.0
test:8.0:
image: php:8.0
test:8.1:
image: php:8.1
before_script:
- *docker_boostrap
script:
@ -41,7 +41,7 @@ test:8.0:
# Codestandards
lint:
image: php:8.0
image: php:8.1
allow_failure: true
script:
- 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)
- Fixed issue with lingering keys causing constant memory growth
- Add PHP8 support

View File

@ -24,7 +24,7 @@ class ResqueFailureRedis implements ResqueFailureInterface
public function __construct($payload, $exception, $worker, $queue)
{
$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->exception = get_class($exception);
$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)) {
fwrite(
STDOUT,
'[' . $level . '][' . strftime('%Y-%m-%d %T') . '] ' .
'[' . $level . '][' . date('Y-m-d H:i:s') . '] ' .
$this->interpolate($message, $context) . PHP_EOL
);
}

View File

@ -215,7 +215,9 @@ class Worker
// Forked and we're the child. Run the job.
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->logger->log(\Psr\Log\LogLevel::INFO, $status);
/** @noinspection PhpParamsInspection */
@ -227,7 +229,7 @@ class Worker
if ($this->child > 0) {
// 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->logger->log(\Psr\Log\LogLevel::INFO, $status);
@ -489,7 +491,7 @@ class Worker
public function registerWorker()
{
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);
$data = json_encode([
'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
]);
Resque::redis()->setex('worker:' . $job->worker, 172800, $data);