public
Description: A new revision of Fuzed, the Erlang-based frontend for web apps. Check out the mailing list at http://groups.google.com/group/fuzed
Clone URL: git://github.com/KirinDave/fuzed.git
Search Repo:
Extracting the dispatch a little.
KirinDave (author)
Sun May 11 19:36:11 -0700 2008
commit  eec6db84255ed74431ac2ecd1b7629306a697273
tree    f012d0769ded87c1bd7de431d93922cf2f756b74
parent  6f4be433ed215bc983b5e4ac346b377c27c21b29
...
4
5
6
 
 
 
7
8
 
9
10
11
12
13
14
 
 
 
 
 
15
16
17
...
90
91
92
93
94
...
4
5
6
7
8
9
10
 
11
12
 
 
 
 
 
13
14
15
16
17
18
19
20
...
93
94
95
 
96
0
@@ -4,14 +4,17 @@
0
 -include("fuzed.hrl").
0
 -compile(export_all).
0
 
0
+provide_pool(_A) ->
0
+ resource_fountain:best_pool_for_details_match(details()).
0
+
0
 out404(A, _GC, SC) ->
0
- Parameters = [{method, handle_request}, {request, {struct, parse_arg(A, SC)}}],
0
+ Parameters = [{request, {struct, parse_arg(A, SC)}}],
0
   io:format("Param restructure:~n~p~n", [Parameters]),
0
- case node_api:safely_send_call_to_pool(handle_request,
0
- Parameters,
0
- {handle_request, {request}},
0
- pure,
0
- details()) of
0
+ Pool = provide_pool(A),
0
+ case node_api:safely_send_call_to_pool_no_lookup(handle_request,
0
+ Parameters,
0
+ pure,
0
+ Pool) of
0
     {result, R} ->
0
       convert_response(R);
0
     {error, R} ->
0
@@ -90,5 +93,4 @@ prep(A) -> A.
0
 details() ->
0
   {ok, Details} =
0
     application:get_env(fuzed_frontend, details),
0
- error_logger:info_msg("Using frontend details ~p~n", [Details]),
0
   Details.
...
3
4
5
6
 
7
8
9
...
30
31
32
 
 
 
33
34
35
 
 
36
37
38
39
40
 
41
42
43
...
3
4
5
 
6
7
8
9
...
30
31
32
33
34
35
36
 
 
37
38
39
40
41
42
 
43
44
45
46
0
@@ -3,7 +3,7 @@
0
 % Functional calls
0
 -export([parse_sentence/2, semrep_for_sentence/2, nlmatch_semreps/3, details/1, stop/1, heat/1, morphemes_for_sentence/2,
0
          api/1, api_signature/1, safely_send_call_to_pool/4, safely_send_call_to_pool/5, send_call/3, send_call/4,
0
- heat/2]).
0
+ heat/2, safely_send_call_to_pool_no_lookup/4]).
0
 
0
 -include("fuzed.hrl").
0
 
0
@@ -30,14 +30,17 @@ safely_send_call_to_pool(Method, Parameters, ApiSpec, Details) ->
0
 % Valid retkinds are json and erlang
0
 safely_send_call_to_pool(Method, Parameters, ApiSpec, RetType, Details) ->
0
   PoolSearch = resource_fountain:pool_for_dispatch(ApiSpec, Details),
0
+ safely_send_call_to_pool_no_lookup(Method, Parameters, RetType, PoolSearch).
0
+
0
+safely_send_call_to_pool_no_lookup(Method, Parameters, RetType, Pool) ->
0
   Me = self(),
0
- case PoolSearch of
0
- none -> {error, ?NOPOOL_MSG ++ " in safely_send_call_to_pool."};
0
+ case Pool of
0
+ none -> {error, ?NOPOOL_MSG ++ " in safely_send_call_to_pool_with_no_lookup."};
0
     Pool when is_pid(Pool) ->
0
       Worker = spawn(fun() -> independent_pool_call(Pool, Method, Parameters, RetType, Me) end),
0
       receive
0
         {Worker, result, Result} -> Result
0
- after ?GLOBAL_TIMEOUT -> {error, io_lib:format("Request took more than 1 minute. ApiSpec: ~p~nMethod: ~p~nParameters: ~p~n", [ApiSpec, Method, Parameters])}
0
+ after ?GLOBAL_TIMEOUT -> {error, io_lib:format("Request took more than 1 minute. Method: ~p~nParameters: ~p~n", [Method, Parameters])}
0
       end
0
   end.
0
 

Comments

    No one has commented yet.