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,