sumo_db icon indicating copy to clipboard operation
sumo_db copied to clipboard

Update sumo_store to use wpool:call/4

Open Svampen opened this issue 8 years ago • 1 comments

sumo_store uses wpool:call/2 which defaults to a 5 second timeout and to work around this when queries can take longer than 5 seconds, substitution of for example sumo:find_by/5 to sumo:call/3 is needed which will use application:get_env(sumo_db, query_timeout) for the timeout value.

I suggest that sumo_store should be updated to use wpool:call/4 and get timeout (and worker strategy?) from configuration file with application:get_env(sumo_db, query_timeout)

Svampen avatar Jul 27 '17 12:07 Svampen

sumo:call can't be used to call any sumo function because the handle_call/3 in sumo_store for {call,...} applies DocName and State on to the Args before doing erlang:apply/3. This results in my example sumo_store_mysql:find_by(Conditions, SortFields, Limit, Offset, DocName, State) instead of sumo_store_mysql:find_by(DocName, Conditions, SortFields, Limit, Offset, State).

sumo:call/3 can only be used for custom functions (which it states), thought I would have thought that the custom function should follow the same structure of having DocName as first argument and State as last :)

Svampen avatar Jul 27 '17 15:07 Svampen