Skip to content

Commit 094a3ff

Browse files
committed
Merge pull request #20 from JaapRood/master
Make master of scheduler compatible with current master of php-resque
2 parents f4b8f14 + 110e213 commit 094a3ff

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
{ "type": "git", "url": "https://github.com/chrisboulton/php-resque" }
1818
],
1919
"require": {
20-
"chrisboulton/php-resque": "< 1.3"
20+
"chrisboulton/php-resque": "dev-master"
2121
}
22-
}
22+
}

lib/ResqueScheduler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public static function nextDelayedTimestamp($at = null)
223223
$at = self::getTimestamp($at);
224224
}
225225

226-
$items = Resque::redis()->zrangebyscore('delayed_queue_schedule', '-inf', $at, 'LIMIT', 0, 1);
226+
$items = Resque::redis()->zrangebyscore('delayed_queue_schedule', '-inf', $at, array('limit' => array(0, 1)));
227227
if (!empty($items)) {
228228
return $items[0];
229229
}

resque-scheduler.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
require_once dirname(__FILE__) . '/lib/ResqueScheduler/Worker.php';
1616

1717
$REDIS_BACKEND = getenv('REDIS_BACKEND');
18+
$REDIS_BACKEND_DB = getenv('REDIS_BACKEND_DB');
1819
if(!empty($REDIS_BACKEND)) {
19-
Resque::setBackend($REDIS_BACKEND);
20+
if (empty($REDIS_BACKEND_DB))
21+
Resque::setBackend($REDIS_BACKEND);
22+
else
23+
Resque::setBackend($REDIS_BACKEND, $REDIS_BACKEND_DB);
2024
}
2125

2226
// Set log level for resque-scheduler
@@ -48,6 +52,12 @@
4852
require_once $APP_INCLUDE;
4953
}
5054

55+
$PREFIX = getenv('PREFIX');
56+
if(!empty($PREFIX)) {
57+
fwrite(STDOUT, '*** Prefix set to '.$PREFIX."\n");
58+
Resque_Redis::prefix($PREFIX);
59+
}
60+
5161
$worker = new ResqueScheduler_Worker();
5262
$worker->logLevel = $logLevel;
5363

@@ -58,4 +68,4 @@
5868
}
5969

6070
fwrite(STDOUT, "*** Starting scheduler worker\n");
61-
$worker->work($interval);
71+
$worker->work($interval);

0 commit comments

Comments
 (0)