Skip to content

Commit

Permalink
[#22] adding timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ferigis committed Apr 11, 2017
1 parent eda6820 commit 6a314a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/sheldon_suggestions_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ suggestions(MisspelledWords, Lang) ->
-spec add_suggestions(sheldon_result:misspelled_word(), sheldon_dictionary:language()) ->
sheldon_result:misspelled_word().
add_suggestions(#{word := Word} = MisspelledWord, Lang) ->
Candidates = wpool:call(suggestions_pool, {suggest, Word, Lang}),
Timeout = application:get_env(sheldon, suggestion_timeout, 15000),
Candidates = wpool:call(suggestions_pool, {suggest, Word, Lang}, available_worker, Timeout),
MisspelledWord#{candidates => Candidates}.

%%%=============================================================================
Expand Down
3 changes: 2 additions & 1 deletion test/test.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[
{
sheldon,
[ {suggestion_workers, 100}
[ {suggestion_workers, 100},
{suggestion_timeout, 10000}
]
},
{sasl, [{sasl_error_logger, false}]}
Expand Down

0 comments on commit 6a314a6

Please sign in to comment.