Skip to content
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e37b113
yaml formatted
udokmeci Dec 4, 2015
372fb75
yaml composer error
udokmeci Dec 4, 2015
132200c
composer phpunit fix
udokmeci Dec 4, 2015
fb0b162
composer phpunit fix
udokmeci Dec 4, 2015
ac85eea
composer phpunit fix
udokmeci Dec 4, 2015
ef66162
Merge pull request #12 from udokmeci/test
udokmeci Dec 4, 2015
ab092cc
New job outcome handler DELAY_EXPONENTIAL uses exponential back off …
drsdre Dec 21, 2015
9291c59
DELAY_RETRIES has become constant.
drsdre Dec 21, 2015
29ca6a5
Merge pull request #13 from drsdre/delayscheme
udokmeci Dec 21, 2015
d85b5ed
Update BeanstalkController.php
G1K Jan 5, 2016
f60f281
Update BeanstalkController.php
G1K Jan 5, 2016
dbf31d6
Merge pull request #15 from G1K/patch-1
udokmeci Jan 5, 2016
9acd037
returning self::BURY should bury
Feb 23, 2016
b31726e
Fix typo: DELAY_PIRORITY should be DELAY_PRIORITY
Feb 23, 2016
362d97d
Merge pull request #16 from michaelarnauts/bury_should_bury
udokmeci Feb 23, 2016
eaa75b6
Merge pull request #17 from michaelarnauts/typo_priority
udokmeci Feb 23, 2016
d769d4f
phpdoc fixes, class imports
elvenpath Mar 1, 2016
0e14c99
phpdoc fixes, class imports, added exit status
elvenpath Mar 1, 2016
9aa2933
Merge pull request #19 from elvenpath/master
udokmeci Mar 4, 2016
f553402
Added before/after job events
elvenpath Mar 10, 2016
190e7d8
fix typo
elvenpath Mar 10, 2016
81f987a
fixed issue with "afterJob" event not being triggered if there's an e…
elvenpath Mar 10, 2016
2cec0ce
Merge pull request #20 from elvenpath/master
udokmeci Mar 10, 2016
4fba459
Controllable exponential delay
drsdre Mar 24, 2016
11f3168
Merge pull request #22 from drsdre/expdelay-p1
udokmeci Mar 28, 2016
6e4f0d9
Allow you to override BeanstalkController::getBeanstalk to use a diff…
jcherniak Oct 1, 2016
e35a687
Add ability to use action classes in normal controller fashion
jcherniak Nov 3, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update BeanstalkController.php
Specific database other than the standard
  • Loading branch information
G1K committed Jan 5, 2016
commit d85b5eda8d3f83746148aa9a3913e5076328b83b
13 changes: 9 additions & 4 deletions src/udokmeci/yii2beanstalk/BeanstalkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public function getTubes()
return array_unique(array_merge((array) Yii::$app->beanstalk->listTubes(), $this->listenTubes()));
}

public function getDb()
{
return Yii::$app->db;
}

/**
* {@inheritDoc}
*/
Expand All @@ -105,7 +110,7 @@ public function setDBSessionTimeout()
public function mysqlSessionTimeout()
{
try {
$command = Yii::$app->db->createCommand('SET @@session.wait_timeout = 31536000');
$command = getDb()->createCommand('SET @@session.wait_timeout = 31536000');
$command->execute();
} catch (\Exception $e) {
Yii::error(Yii::t('udokmeci.beanstalkd', "Mysql session.wait_timeout command did not succeeded."));
Expand Down Expand Up @@ -256,8 +261,8 @@ public function beforeAction($action)
}

if (time() - $this->_lasttimereconnect > 60 * 60) {
Yii::$app->db->close();
Yii::$app->db->open();
getDb()->close();
getDb()->open();
Yii::info(Yii::t('udokmeci.beanstalkd', "Reconnecting to the DB"));
$this->setDBSessionTimeout();
$this->_lasttimereconnect = time();
Expand Down Expand Up @@ -335,4 +340,4 @@ protected function executeJob($methodName, $job) {
break;
}
}
}
}