Skip to content

Commit

Permalink
Merge pull request chrisboulton#20 from JaapRood/master
Browse files Browse the repository at this point in the history
Make master of scheduler compatible with current master of php-resque
  • Loading branch information
chrisboulton committed Sep 16, 2013
2 parents f4b8f14 + 110e213 commit 094a3ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
{ "type": "git", "url": "https://github.com/chrisboulton/php-resque" }
],
"require": {
"chrisboulton/php-resque": "< 1.3"
"chrisboulton/php-resque": "dev-master"
}
}
}
2 changes: 1 addition & 1 deletion lib/ResqueScheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
14 changes: 12 additions & 2 deletions resque-scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand All @@ -58,4 +68,4 @@
}

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

0 comments on commit 094a3ff

Please sign in to comment.