diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6907bfb..b1e395f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index adfc4a6..2d2507a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/Resque/Failure/ResqueFailureRedis.php b/src/Resque/Failure/ResqueFailureRedis.php index 5695288..33a9cc1 100644 --- a/src/Resque/Failure/ResqueFailureRedis.php +++ b/src/Resque/Failure/ResqueFailureRedis.php @@ -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(); diff --git a/src/Resque/Log.php b/src/Resque/Log.php index 2ac05ce..986ae2b 100644 --- a/src/Resque/Log.php +++ b/src/Resque/Log.php @@ -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 ); } diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index 93bd81e..550bdef 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -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);