diff --git a/composer.json b/composer.json index e4b84b7..7acc847 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,6 @@ { "type": "git", "url": "https://github.com/chrisboulton/php-resque" } ], "require": { - "chrisboulton/php-resque": "< 1.3" + "chrisboulton/php-resque": "dev-master" } -} \ No newline at end of file +} diff --git a/lib/ResqueScheduler.php b/lib/ResqueScheduler.php index d744c5b..644ba4b 100644 --- a/lib/ResqueScheduler.php +++ b/lib/ResqueScheduler.php @@ -223,7 +223,7 @@ public static function nextDelayedTimestamp($at = null) $at = self::getTimestamp($at); } - $items = Resque::redis()->zrangebyscore('delayed_queue_schedule', '-inf', $at, 'LIMIT', 0, 1); + $items = Resque::redis()->zrangebyscore('delayed_queue_schedule', '-inf', $at, array('limit' => array(0, 1))); if (!empty($items)) { return $items[0]; } diff --git a/resque-scheduler.php b/resque-scheduler.php index a7d1763..e061f0e 100644 --- a/resque-scheduler.php +++ b/resque-scheduler.php @@ -15,8 +15,12 @@ require_once dirname(__FILE__) . '/lib/ResqueScheduler/Worker.php'; $REDIS_BACKEND = getenv('REDIS_BACKEND'); +$REDIS_BACKEND_DB = getenv('REDIS_BACKEND_DB'); if(!empty($REDIS_BACKEND)) { - Resque::setBackend($REDIS_BACKEND); + if (empty($REDIS_BACKEND_DB)) + Resque::setBackend($REDIS_BACKEND); + else + Resque::setBackend($REDIS_BACKEND, $REDIS_BACKEND_DB); } // Set log level for resque-scheduler @@ -48,6 +52,12 @@ require_once $APP_INCLUDE; } +$PREFIX = getenv('PREFIX'); +if(!empty($PREFIX)) { + fwrite(STDOUT, '*** Prefix set to '.$PREFIX."\n"); + Resque_Redis::prefix($PREFIX); +} + $worker = new ResqueScheduler_Worker(); $worker->logLevel = $logLevel; @@ -58,4 +68,4 @@ } fwrite(STDOUT, "*** Starting scheduler worker\n"); -$worker->work($interval); \ No newline at end of file +$worker->work($interval);