Просмотр исходного кода

change error message for no_connection

Yuriy Zhloba 9 лет назад
Родитель
Сommit
6b0ff182c2
3 измененных файлов с 6 добавлено и 6 удалено
  1. 3 3
      src/epgsql_pool_worker.erl
  2. 2 2
      test/epgsql_pool_SUITE.erl
  3. 1 1
      test/epgsql_pool_tests.erl

+ 3 - 3
src/epgsql_pool_worker.erl

@@ -54,7 +54,7 @@ handle_call(_, _From, #state{connection = undefined} = State) ->
     {reply, {error, no_connection}, State};
 
 handle_call(_, _From, #state{connection = #epgsql_connection{sock = undefined}} = State) ->
-    {reply, {error, reconnecting}, State};
+    {reply, {error, no_connection}, State};
 
 handle_call(get_sock, _From,
             #state{connection = #epgsql_connection{sock = Sock}} = State) ->
@@ -63,7 +63,7 @@ handle_call(get_sock, _From,
 handle_call({equery, Stmt, Params}, _From,
             #state{connection = #epgsql_connection{sock = Sock}} = State) ->
     Reply = case process_info(Sock, status) of
-                undefined -> {error, reconnecting};
+                undefined -> {error, no_connection};
                 {status, _} -> epgsql:equery(Sock, Stmt, Params)
             end,
     {reply, Reply, State};
@@ -71,7 +71,7 @@ handle_call({equery, Stmt, Params}, _From,
 handle_call({squery, Stmt}, _From,
             #state{connection = #epgsql_connection{sock = Sock}} = State) ->
     Reply = case process_info(Sock, status) of
-                undefined -> {error, reconnecting};
+                undefined -> {error, no_connection};
                 {status, _} -> epgsql:squery(Sock, Stmt)
             end,
     {reply, Reply, State};

+ 2 - 2
test/epgsql_pool_SUITE.erl

@@ -144,13 +144,13 @@ reconnect_test(Config) ->
 
     R2 = epgsql_pool:query(Worker, "select * from item"),
     ct:pal("second query goes immediatelly ~p", [R2]),
-    {error, reconnecting} = R2,
+    {error, no_connection} = R2,
 
     timer:sleep(50),
 
     R3 = epgsql_pool:query(Worker, "select * from item"),
     ct:pal("third query goes after 50 ms ~p", [R3]),
-    {error, reconnecting} = R3,
+    {error, no_connection} = R3,
 
     timer:sleep(150),
 

+ 1 - 1
test/epgsql_pool_tests.erl

@@ -12,7 +12,7 @@ get_set_settings_test() ->
                    max_reconnect_timeout => 5000,
                    min_reconnect_timeout => 100,
                    pooler_get_worker_timeout => 10000,
-                   pooler_max_queue => 100,
+                   pooler_max_queue => 1000,
                    query_timeout => 10000},
                  epgsql_pool:get_settings()),