Skip to content

Commit

Permalink
fix: finish spec
Browse files Browse the repository at this point in the history
  • Loading branch information
killme2008 committed Dec 4, 2023
1 parent 67e9d81 commit d5914e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/greptimedb_stream.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ write_request(Stream, Request) ->
end.

%% @doc Finish the gRPC stream and wait the result.
-spec finish(Stream :: map()) -> {ok, term()} | {error, term()}.
-spec finish(Stream :: map()) -> {ok, term()} | {error, term(), term()} | timeout | stream_finished.
finish(Stream) ->
finish(Stream, 10_000).

%% @doc Finish the gRPC stream and wait the result with timeout in milliseconds.
-spec finish(Stream :: map(), Timeout :: integer()) -> {ok, term()} | {error, term()}.
-spec finish(Stream :: map(), Timeout :: integer()) -> {ok, term()} | {error, term(), term()} | timeout | stream_finished.
finish(Stream, Timeout) ->
try
ok = grpcbox_client:close_send(Stream),
Expand Down
4 changes: 2 additions & 2 deletions src/greptimedb_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ shoot(Stream, ?REQ(Req, _), #state{requests = #{pending_count := 0}} = State, Re
case greptimedb_stream:write_request(Stream, Req) of
ok ->
Result = case greptimedb_stream:finish(Stream) of
{ok, Resp, _} ->
{ok, Resp} ->
{ok, Resp};
{error, {?GRPC_STATUS_UNAUTHENTICATED, Msg}, Other} ->
{error, {unauth, Msg, Other}};
Err ->
Err
{error, Err}
end,

lists:foreach(fun(ReplyTo) ->
Expand Down

0 comments on commit d5914e8

Please sign in to comment.