Created
September 27, 2012 12:29
-
-
Save loxs/3793738 to your computer and use it in GitHub Desktop.
riakc_action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-spec riakc_action(Action::put|get|delete|get_index|mapred|search, RiakcArgs::list()) -> term(). | |
riakc_action(Action, RiakcArgs) -> | |
riakc_action(Action, RiakcArgs, 0). | |
riakc_action(_Action, _RiakcArgs, Tries) when Tries > 16 -> | |
{error, disconnected}; | |
riakc_action(Action, RiakcArgs, Tries) -> | |
RiakcPid = poolboy:checkout(wsdb_riakc_pool), | |
try apply(riakc_pb_socket, Action, [RiakcPid|RiakcArgs]) of | |
{error, disconnected} -> | |
riakc_action(Action, RiakcArgs, Tries+1); | |
R -> | |
R | |
catch | |
TypeOfError:ExceptionPattern -> | |
lager:error("error in riakc_action ~p ~p", [TypeOfError, ExceptionPattern]), | |
{error, TypeOfError, ExceptionPattern} | |
after | |
poolboy:checkin(wsdb_riakc_pool, RiakcPid) | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment