dev vouch dev on at. thats about it atvouch.dev
8
fork

Configure Feed

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

fix multi-replica hooks

Luna 58b119f8 c55b1e2c

+35 -17
+14 -4
appview/config/config.exs
··· 8 8 level: :info, 9 9 format: "$time $metadata[$level] $message\n" 10 10 11 - config :atvouch, Atvouch.Repo, 12 - database: "atvouch_#{config_env()}.db", 13 - pool_size: 1 14 - 15 11 config :atvouch, 16 12 ecto_repos: [Atvouch.Repo] 13 + 14 + all_repos = [ 15 + Atvouch.Repo, 16 + Atvouch.Repo.Replica1, 17 + Atvouch.Repo.Replica2, 18 + Atvouch.Repo.Replica3, 19 + Atvouch.Repo.Replica4 20 + ] 21 + 22 + for repo <- all_repos do 23 + config :atvouch, repo, 24 + database: "atvouch_#{config_env()}.db", 25 + pool_size: 1 26 + end 17 27 18 28 config :tesla, adapter: Tesla.Adapter.Mint 19 29
+11 -1
appview/config/runtime.exs
··· 13 13 atvouch_endpoint: System.fetch_env!("ATVOUCH_ENDPOINT"), 14 14 metrics_token: System.fetch_env!("ATVOUCH_METRICS_TOKEN") 15 15 16 - config :atvouch, Atvouch.Repo, database: System.fetch_env!("ATVOUCH_DB_PATH") 16 + db_path = System.fetch_env!("ATVOUCH_DB_PATH") 17 + 18 + for repo <- [ 19 + Atvouch.Repo, 20 + Atvouch.Repo.Replica1, 21 + Atvouch.Repo.Replica2, 22 + Atvouch.Repo.Replica3, 23 + Atvouch.Repo.Replica4 24 + ] do 25 + config :atvouch, repo, database: db_path 26 + end 17 27 end
+10 -12
appview/lib/atvouch/application.ex
··· 6 6 port = Application.get_env(:atvouch, :port) 7 7 8 8 children = 9 - [ 10 - Atvouch.Repo 11 - ] ++ 12 - replica_children() ++ 9 + repos() ++ 13 10 [ 14 11 {Bandit, plug: Atvouch.Router, port: port, ip: {127, 0, 0, 1}} 15 12 ] ++ tap_children() 16 - 17 13 18 14 opts = [strategy: :one_for_one, name: Atvouch.Supervisor] 19 15 Supervisor.start_link(children, opts) 20 16 end 21 17 22 - defp replica_children do 23 - if Application.get_env(:atvouch, :start_replicas, true) do 24 - %{read_replicas: replicas} = Atvouch.Repo.repo_spec() 25 - Enum.map(replicas, & &1) 26 - else 27 - [] 28 - end 18 + defp repos do 19 + %{read_replicas: replicas} = Atvouch.Repo.repo_spec() 20 + 21 + [Atvouch.Repo] ++ 22 + if Application.get_env(:atvouch, :start_replicas, true) do 23 + replicas 24 + else 25 + [] 26 + end 29 27 end 30 28 31 29 defp tap_children do