Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sumo_store to use wpool:call/4 #327

Open
Svampen opened this issue Jul 27, 2017 · 1 comment
Open

Update sumo_store to use wpool:call/4 #327

Svampen opened this issue Jul 27, 2017 · 1 comment

Comments

@Svampen
Copy link

Svampen commented Jul 27, 2017

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
Copy link
Author

Svampen commented Jul 27, 2017

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant