this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use get_cluster with backoff in workload setup

garrison 67aa60a8 ba62ffd6

+9 -5
+9 -5
lib/workloads.ex
··· 1 1 defmodule Hobbes.Workloads do 2 2 require Logger 3 3 4 - alias Trinity.{Sim, SimProcess, SimServer, SimLogger} 4 + alias Trinity.{Sim, SimServer, SimLogger} 5 5 alias Hobbes.Structs.Cluster 6 - alias Hobbes.Servers.{Coordinator, Manager} 6 + 7 + import Hobbes.Utils 7 8 8 9 defmodule Workload do 9 10 @callback run(context :: map, opts :: keyword) :: {:ok, term} ··· 148 149 cluster_opts = Keyword.put(cluster_opts, :distributed, Sim.simulated?()) 149 150 {:ok, coordinator_pids} = Hobbes.Sandbox.start_cluster(cluster_opts) 150 151 151 - SimProcess.sleep(2_000) 152 - {:ok, {manager_pid, _gen}} = Coordinator.get_manager(hd(coordinator_pids)) 153 - {:ok, %Cluster{} = cluster} = Manager.get_cluster(manager_pid) 152 + {:ok, %Cluster{} = cluster} = backoff(nil, fn _acc -> 153 + case Hobbes.get_cluster(coordinator_pids) do 154 + {:ok, _cluster} = result -> {:halt, result} 155 + {:error, _err} -> {:cont, nil} 156 + end 157 + end, 20) 154 158 155 159 context = %{cluster: cluster} 156 160