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

CommandComplete finishes execution

Anton Lebedevich 13 лет назад
Родитель
Сommit
dbbb91ade1
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      src/pgsql_sock.erl

+ 8 - 1
src/pgsql_sock.erl

@@ -428,9 +428,16 @@ on_message({$D, <<_Count:?int16, Bin/binary>>}, State) ->
 
 %% CommandComplete
 on_message({$C, Bin}, State) ->
+    #state{queue = Q} = State,
     Complete = pgsql_wire:decode_complete(Bin),
     notify(State, {complete, Complete}),
-    {noreply, State};
+    State2 = case request_tag(State) of
+                 C when C == execute ->
+                     State#state{queue = queue:drop(Q)};
+                 _ ->
+                     State
+             end,
+    {noreply, State2};
 
 %% EmptyQueryResponse
 on_message({$I, _Bin}, State) ->