]> Entropealabs - cluster_kv.git/commitdiff
for info events, handle them even if you aren't in the ready state
authorChristopher <chris@entropealabs.com>
Mon, 9 Mar 2020 14:41:37 +0000 (09:41 -0500)
committerChristopher <chris@entropealabs.com>
Mon, 9 Mar 2020 14:41:37 +0000 (09:41 -0500)
lib/cluster_kv/ring.ex

index f189fc0ca4b3ff41b1454698002a1b78736cf93a..2924bf8764e5b8d926f19f8c8c98158832df0a50 100644 (file)
@@ -190,7 +190,7 @@ defmodule ClusterKV.Ring do
 
   def handle_cast(
         {:batch, batch},
-        @ready,
+        _,
         %SL{data: %Ring{name: n, ring: r, replicas: repls}} = sl
       ) do
     batches =
@@ -208,7 +208,7 @@ defmodule ClusterKV.Ring do
 
   def handle_cast(
         {:put_wildcard, header, key, value, split_on, join, wildcard},
-        @ready,
+        _,
         %SL{data: %Ring{name: n, ring: r, replicas: repls}} = sl
       ) do
     key
@@ -220,7 +220,7 @@ defmodule ClusterKV.Ring do
 
   def handle_cast(
         {:put, key, value},
-        @ready,
+        _,
         %SL{data: %Ring{name: n, ring: r, replicas: repls}} = sl
       ) do
     nodes = HashRing.key_to_nodes(r, key, repls)
@@ -245,7 +245,7 @@ defmodule ClusterKV.Ring do
 
   def handle_info(
         {:get_wildcard, key, parts, wildcard, ref, node},
-        @ready,
+        _,
         %SL{data: %Ring{name: n, db: db, node: me}} = sl
       ) do
     val =
@@ -271,7 +271,7 @@ defmodule ClusterKV.Ring do
     {:ok, sl, []}
   end
 
-  def handle_info({:reply, val, ref, from}, @ready, %SL{data: %Ring{requests: reqs} = data} = sl) do
+  def handle_info({:reply, val, ref, from}, _, %SL{data: %Ring{requests: reqs} = data} = sl) do
     {requests, actions} = maybe_reply(ref, reqs, val, from)
     {:ok, %SL{sl | data: %Ring{data | requests: requests}}, actions}
   end