From f69330d6379cc616d17e10b228a521ec182332e8 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 22 Jun 2018 20:13:16 +1200 Subject: [PATCH] Update Docs --- CHANGELOG.md | 1 + README.md | 9 ++++----- bin/resque | 7 ++++--- lib/Resque.php | 2 +- lib/Resque/Failure/Redis.php | 1 + lib/Resque/Log.php | 4 ++++ 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d69f841..203d10a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 1.4.2 (2018-05-30) - Reimplemented credis due to issues with Redis: Connection Closed. +- Updated Docs. ## 1.4.1 (2018-05-29) - Updated travis builds to run on PHP 7.0, 7.1 and 7.2. diff --git a/README.md b/README.md index 32e5db7..7bc468f 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,8 @@ Jobs are queued as follows: // Required if redis is located elsewhere Resque::setBackend('localhost:6379'); -$args = array( - 'name' => 'TestName' - ); +$args = ['name' => 'TestName']; + Resque::enqueue('default', 'My_Job', $args); ``` @@ -141,7 +140,7 @@ Resque::dequeue('default', ['My_Job']); Resque::dequeue('default', ['My_Job' => '087df5819a790ac666c9608e2234b21e']); // Removes job class 'My_Job' with arguments of queue 'default' -Resque::dequeue('default', ['My_Job' => array('foo' => 1, 'bar' => 2)]); +Resque::dequeue('default', ['My_Job' => ['foo' => 1, 'bar' => 2]]); // Removes multiple jobs Resque::dequeue('default', ['My_Job', 'My_Job2']); @@ -345,7 +344,7 @@ Resque_Event::listen('eventName', [callback]); * A string with the name of a function * An array containing an object and method to call * An array containing an object and a static method to call -* A closure (PHP 5.3+) +* A closure Events may pass arguments (documented below), so your callback should accept these arguments. diff --git a/bin/resque b/bin/resque index 5867c60..23ff6d6 100755 --- a/bin/resque +++ b/bin/resque @@ -41,15 +41,16 @@ $REDIS_BACKEND = getenv('REDIS_BACKEND'); // A redis database number $REDIS_BACKEND_DB = getenv('REDIS_BACKEND_DB'); if (!empty($REDIS_BACKEND)) { - if (empty($REDIS_BACKEND_DB)) + if (empty($REDIS_BACKEND_DB)) { Resque::setBackend($REDIS_BACKEND); - else + } else { Resque::setBackend($REDIS_BACKEND, $REDIS_BACKEND_DB); + } } $logLevel = false; $LOGGING = getenv('LOGLEVEL'); -if (!empty($LOGGING) ) { +if (!empty($LOGGING)) { $logLevel = $LOGGING; } diff --git a/lib/Resque.php b/lib/Resque.php index cb30123..222336f 100644 --- a/lib/Resque.php +++ b/lib/Resque.php @@ -10,7 +10,7 @@ class Resque { - const VERSION = '1.4'; + const VERSION = '1.4.2'; const DEFAULT_INTERVAL = 5; diff --git a/lib/Resque/Failure/Redis.php b/lib/Resque/Failure/Redis.php index caff0d5..dacde7e 100644 --- a/lib/Resque/Failure/Redis.php +++ b/lib/Resque/Failure/Redis.php @@ -16,6 +16,7 @@ class Resque_Failure_Redis implements Resque_Failure_Interface * @param object $exception Instance of the exception that was thrown by the failed job. * @param object $worker Instance of Resque_Worker that received the job. * @param string $queue The name of the queue the job was fetched from. + * @throws Resque_RedisException */ public function __construct($payload, $exception, $worker, $queue) { diff --git a/lib/Resque/Log.php b/lib/Resque/Log.php index e0238e2..6735418 100644 --- a/lib/Resque/Log.php +++ b/lib/Resque/Log.php @@ -28,6 +28,10 @@ class Resque_Log extends Psr\Log\AbstractLogger public function log($level, $message, array $context = []) { $logLevels = ["emergency", "alert", "critical", "error", "warning", "notice", "info", "debug"]; + /** + * Only log things with a higher rating than the current log level. + * e.g If set as 'alert' will only alert for 'emergency' and 'alert' logs. + */ if (array_search($level, $logLevels) <= array_search($this->logLevel, $logLevels)) { fwrite( STDOUT,