Skip to content

Commit

Permalink
Fix event watch crash when timeout reached and no events received
Browse files Browse the repository at this point in the history
  • Loading branch information
reset committed Feb 16, 2015
1 parent dd9e387 commit 7cbba9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/consul/watch/event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ defmodule Consul.Watch.Event do
# Private
#

defp notify_events(events, em, nil, _) do
defp notify_events([], _em, _index, _last_time), do: :ok
defp notify_events(events, em, nil, _last_time) do
Watch.Handler.notify_events(em, events)
end
defp notify_events(events, em, _, last_time) do
defp notify_events(events, em, _index, last_time) do
[latest|_] = Event.sort(events)
if latest.l_time > last_time do
Watch.Handler.notify_events(em, [latest])
Expand Down

0 comments on commit 7cbba9c

Please sign in to comment.