Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Obey contract in logplex_channel:logs (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
ypaq authored Mar 21, 2018
1 parent 821261e commit 22d3fef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/logplex_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ lookup_tokens(ChannelId) when is_binary(ChannelId) ->
lookup_drains(ChannelId) when is_binary(ChannelId) ->
logplex_drain:lookup_by_channel(ChannelId).

-spec logs(binary(), integer()) -> [binary()] | {error, term()}.
logs(ChannelId, Num) when is_binary(ChannelId), is_integer(Num) ->

{Map, Interval, _TS} = logplex_shard_info:read(logplex_read_pool_map),
Index = redis_shard:key_to_index(binary_to_list(ChannelId)),
{_RedisUrl, Pool} = redis_shard:get_matching_pool(Index, Map, Interval),
Expand All @@ -240,7 +240,7 @@ logs(ChannelId, Num) when is_binary(ChannelId), is_integer(Num) ->
{'EXIT', Err} ->
?ERR("at=fetch_logs channel_id=~s err=\"~p\"",
[ChannelId, Err]),
[];
{error, Err};
Logs ->
Logs
end.
Expand Down

0 comments on commit 22d3fef

Please sign in to comment.