]> Entropealabs - wampex_router.git/commitdiff
handle updating currupted call index live-callee-logging
authorChristopher <chris@entropealabs.com>
Thu, 16 Apr 2020 16:45:06 +0000 (11:45 -0500)
committerChristopher <chris@entropealabs.com>
Thu, 16 Apr 2020 16:45:06 +0000 (11:45 -0500)
lib/router/realms/session.ex

index 22636bf8043b44be329f4cf60fe66d93e9e8db16..f82dde3364ea8f63eda220935951dbd78efb5ba0 100644 (file)
@@ -98,10 +98,16 @@ defmodule Wampex.Router.Realms.Session do
     current_id + 1
   end
 
-  defp update_round_robin({id, [values] = v}, value) do
+  defp update_round_robin({id, v}, value) do
     Logger.info("Update Round Robin: #{inspect(id)} -> #{inspect(v)}: #{inspect(value)}")
 
-    case values + 1 do
+    val =
+      case v do
+        [values] -> values
+        [_ | t] -> Enum.reduce(t, 0, fn a, _acc -> a end)
+      end
+
+    case val + 1 do
       ni when ni < value ->
         Logger.info("Incrementing round robin: #{inspect(id)} to #{inspect(ni)}")
         {id, [ni]}