From 4241f5ca5668a580f2e908da9237344f27b4f32d Mon Sep 17 00:00:00 2001 From: Rob Holmes Date: Thu, 9 May 2013 23:02:05 +0200 Subject: [PATCH 1/5] Removing version requirements for php-resque --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 +} From 642b229a038370876dee419804dae8b3af09918b Mon Sep 17 00:00:00 2001 From: Rob Holmes Date: Sat, 11 May 2013 12:04:37 +0200 Subject: [PATCH 2/5] Adding database and prefix selection, to be compatible with php-resque. --- resque-scheduler.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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); From f1a5596f81269809a53a7858355600e226990a9b Mon Sep 17 00:00:00 2001 From: Rob Holmes Date: Sat, 11 May 2013 12:06:36 +0200 Subject: [PATCH 3/5] Fixing zrangebyscore. --- lib/ResqueScheduler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]; } From 37ea2e2a545af6e312986638480998ef7d848d61 Mon Sep 17 00:00:00 2001 From: Rob Holmes Date: Sat, 11 May 2013 12:12:59 +0200 Subject: [PATCH 4/5] Removing unneeded fix in last commit. --- lib/ResqueScheduler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ResqueScheduler.php b/lib/ResqueScheduler.php index 644ba4b..d744c5b 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, array('limit' => array(0, 1))); + $items = Resque::redis()->zrangebyscore('delayed_queue_schedule', '-inf', $at, 'LIMIT', 0, 1); if (!empty($items)) { return $items[0]; } From 110e213b5f6c5368b5ac8f3cd1067898b2eac03e Mon Sep 17 00:00:00 2001 From: Jaap Rood Date: Tue, 10 Sep 2013 18:32:36 +1000 Subject: [PATCH 5/5] Revert "Removing unneeded fix in last commit." This reverts commit 37ea2e2a545af6e312986638480998ef7d848d61. --- lib/ResqueScheduler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]; }