Skip to content

Commit 642b229

Browse files
committed
Adding database and prefix selection, to be compatible with php-resque.
1 parent 4241f5c commit 642b229

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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)