Scott Hiett commited on
Commit
8155c92
1 Parent(s): 1b2415c

Improve some comments for clarity

Browse files
Files changed (1) hide show
  1. lib/srh/redis/client_worker.ex +3 -1
lib/srh/redis/client_worker.ex CHANGED
@@ -31,6 +31,7 @@ defmodule Srh.Redis.ClientWorker do
31
  {:ok, res} ->
32
  {:reply, {:ok, res}, state}
33
 
 
34
  {:error, res} ->
35
  {:reply, {:error, res}, state}
36
  end
@@ -61,7 +62,8 @@ defmodule Srh.Redis.ClientWorker do
61
  } = state
62
  )
63
  when is_binary(connection_string) do
64
- # Will cause a crash for this genserver if the connection fails
 
65
  {:ok, pid} = Redix.start_link(connection_string)
66
  {:noreply, %{state | redix_pid: pid}}
67
  end
 
31
  {:ok, res} ->
32
  {:reply, {:ok, res}, state}
33
 
34
+ # Both connection errors and Redis command errors will be handled here
35
  {:error, res} ->
36
  {:reply, {:error, res}, state}
37
  end
 
62
  } = state
63
  )
64
  when is_binary(connection_string) do
65
+ # NOTE: Redix only seems to open the connection when the first command is sent
66
+ # This means that this will return :ok even if the connection string may not actually be connectable
67
  {:ok, pid} = Redix.start_link(connection_string)
68
  {:noreply, %{state | redix_pid: pid}}
69
  end