Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
0a453043
Commit
0a453043
authored
Oct 30, 2011
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added an event for server failover logging
- added support for optional events to plugin system
parent
15379ebf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
library/Solarium/Client.php
library/Solarium/Client.php
+5
-3
library/Solarium/Plugin/Loadbalancer.php
library/Solarium/Plugin/Loadbalancer.php
+5
-3
No files found.
library/Solarium/Client.php
View file @
0a453043
...
...
@@ -457,10 +457,12 @@ class Solarium_Client extends Solarium_Configurable
protected
function
_callPlugins
(
$event
,
$params
,
$resultOverride
=
false
)
{
foreach
(
$this
->
_pluginInstances
AS
$plugin
)
{
$result
=
call_user_func_array
(
array
(
$plugin
,
$event
),
$params
);
if
(
method_exists
(
$plugin
,
$event
))
{
$result
=
call_user_func_array
(
array
(
$plugin
,
$event
),
$params
);
if
(
$result
!==
null
&&
$resultOverride
)
{
return
$result
;
if
(
$result
!==
null
&&
$resultOverride
)
{
return
$result
;
}
}
}
}
...
...
library/Solarium/Plugin/Loadbalancer.php
View file @
0a453043
...
...
@@ -452,20 +452,22 @@ class Solarium_Plugin_Loadbalancer extends Solarium_Plugin_Abstract
*/
protected
function
_getLoadbalancedResponse
(
$request
)
{
$this
->
_serverExcludes
=
array
();
// reset for each query
$adapter
=
$this
->
_client
->
getAdapter
();
if
(
$this
->
getFailoverEnabled
()
==
true
)
{
$e
=
new
Solarium_Exception
(
'Maximum number of loadbalancer retries reached'
);
$this
->
_serverExcludes
=
array
();
// reset
for
(
$i
=
0
;
$i
<=
$this
->
getFailoverMaxRetries
();
$i
++
)
{
$options
=
$this
->
_getRandomServerOptions
();
$adapter
->
setOptions
(
$options
);
try
{
try
{
return
$adapter
->
execute
(
$request
);
}
catch
(
Solarium_Client_HttpException
$e
)
{
// ignore HTTP errors, try again
// ignore HTTP errors and try again
// but do issue an event for things like logging
$this
->
_client
->
triggerEvent
(
'LoadbalancerServerFail'
,
array
(
$options
,
$e
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment