mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-01 03:46:44 +01:00
add ranch connection drainer
This commit is contained in:
parent
d56c5f2caa
commit
603c8d4867
4 changed files with 10 additions and 5 deletions
|
@ -24,7 +24,10 @@ defmodule Philomena.Application do
|
||||||
{Redix, name: :redix, host: Application.get_env(:philomena, :redis_host)},
|
{Redix, name: :redix, host: Application.get_env(:philomena, :redis_host)},
|
||||||
|
|
||||||
# Start the endpoint when the application starts
|
# Start the endpoint when the application starts
|
||||||
PhilomenaWeb.Endpoint
|
PhilomenaWeb.Endpoint,
|
||||||
|
|
||||||
|
# Connection drainer for SIGTERM
|
||||||
|
{RanchConnectionDrainer, ranch_ref: PhilomenaWeb.Endpoint.HTTP, shutdown: 30_000}
|
||||||
]
|
]
|
||||||
|
|
||||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||||
|
|
|
@ -82,15 +82,15 @@ defmodule PhilomenaWeb.CommissionController do
|
||||||
defp presence([]),
|
defp presence([]),
|
||||||
do: nil
|
do: nil
|
||||||
|
|
||||||
defp permit_map(x) when is_map(x), do: x
|
|
||||||
defp permit_map(_), do: nil
|
|
||||||
|
|
||||||
defp presence(string) when is_binary(string),
|
defp presence(string) when is_binary(string),
|
||||||
do: if(String.trim(string) == "", do: nil, else: string)
|
do: if(String.trim(string) == "", do: nil, else: string)
|
||||||
|
|
||||||
defp presence(object),
|
defp presence(object),
|
||||||
do: object
|
do: object
|
||||||
|
|
||||||
|
defp permit_map(x) when is_map(x), do: x
|
||||||
|
defp permit_map(_), do: nil
|
||||||
|
|
||||||
defp to_f(input) do
|
defp to_f(input) do
|
||||||
case Float.parse(to_string(input)) do
|
case Float.parse(to_string(input)) do
|
||||||
{float, _rest} -> float
|
{float, _rest} -> float
|
||||||
|
|
3
mix.exs
3
mix.exs
|
@ -63,7 +63,8 @@ defmodule Philomena.MixProject do
|
||||||
{:phoenix_mtm, "~> 1.0.0"},
|
{:phoenix_mtm, "~> 1.0.0"},
|
||||||
{:yaml_elixir, "~> 2.4.0"},
|
{:yaml_elixir, "~> 2.4.0"},
|
||||||
{:distillery, "~> 2.1"},
|
{:distillery, "~> 2.1"},
|
||||||
{:dialyxir, "~> 0.5.1"}
|
{:dialyxir, "~> 0.5.1"},
|
||||||
|
{:ranch_connection_drainer, "~> 0.1"}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
1
mix.lock
1
mix.lock
|
@ -54,6 +54,7 @@
|
||||||
"pow": {:hex, :pow, "1.0.19", "e6295de629338661afdc52b3420f1fa37c191d246aef5d844161843fed6fe88b", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.3.0 or ~> 1.4.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, ">= 2.0.0 and <= 3.0.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:plug, ">= 1.5.0 and < 2.0.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "da77fab98e038b39c5360a77dc98e606cdd1446dabdd65a88991e8b23f67a356"},
|
"pow": {:hex, :pow, "1.0.19", "e6295de629338661afdc52b3420f1fa37c191d246aef5d844161843fed6fe88b", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.3.0 or ~> 1.4.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, ">= 2.0.0 and <= 3.0.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:plug, ">= 1.5.0 and < 2.0.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "da77fab98e038b39c5360a77dc98e606cdd1446dabdd65a88991e8b23f67a356"},
|
||||||
"qrcode": {:hex, :qrcode, "0.1.5", "551271830515c150f34568345b060c625deb0e6691db2a01b0a6de3aafc93886", [:mix], [], "hexpm", "a266b7fb7be0d3b713912055dde3575927eca920e5d604ded45cd534f6b7a447"},
|
"qrcode": {:hex, :qrcode, "0.1.5", "551271830515c150f34568345b060c625deb0e6691db2a01b0a6de3aafc93886", [:mix], [], "hexpm", "a266b7fb7be0d3b713912055dde3575927eca920e5d604ded45cd534f6b7a447"},
|
||||||
"ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm", "451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7"},
|
"ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm", "451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7"},
|
||||||
|
"ranch_connection_drainer": {:hex, :ranch_connection_drainer, "0.1.4", "d6af517b42944a60ca65f0e4a0e76ad4fa81b241f9bad4c26a22d3a7a7767f85", [:mix], [{:ranch, "~> 1.6", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "f3621b1a486f33e24fa25f7e249a65d05eb75d8fe32fc5d009c39228343c5545"},
|
||||||
"redix": {:hex, :redix, "0.10.4", "b87c1728e02dd8bad0e8ed2a97c4855d9677dfcefb293800fdb1ca726278ea27", [:mix], [{:castore, "~> 0.1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cdf44832b01286f594846d8858866b4ee006c056b027d15557e17b0df9203584"},
|
"redix": {:hex, :redix, "0.10.4", "b87c1728e02dd8bad0e8ed2a97c4855d9677dfcefb293800fdb1ca726278ea27", [:mix], [{:castore, "~> 0.1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cdf44832b01286f594846d8858866b4ee006c056b027d15557e17b0df9203584"},
|
||||||
"remote_ip": {:hex, :remote_ip, "0.2.0", "6a40b87bc06fb33c71e423e4f2cdc76e45d42326508b4f9aaef6ff576190443d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:inet_cidr, "~> 1.0", [hex: :inet_cidr, repo: "hexpm", optional: false]}, {:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "a88e47d23c476ad11102d9f4f9aacf5dbed75656c810c1551f782095c15dce75"},
|
"remote_ip": {:hex, :remote_ip, "0.2.0", "6a40b87bc06fb33c71e423e4f2cdc76e45d42326508b4f9aaef6ff576190443d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:inet_cidr, "~> 1.0", [hex: :inet_cidr, repo: "hexpm", optional: false]}, {:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "a88e47d23c476ad11102d9f4f9aacf5dbed75656c810c1551f782095c15dce75"},
|
||||||
"retry": {:hex, :retry, "0.13.0", "bb9b2713f70f39337837852337ad280c77662574f4fb852a8386c269f3d734c4", [:mix], [], "hexpm", "f9da7547ffe15d84f880d4762c76661df5d5a5dd38d55860081e73921ac59fa3"},
|
"retry": {:hex, :retry, "0.13.0", "bb9b2713f70f39337837852337ad280c77662574f4fb852a8386c269f3d734c4", [:mix], [], "hexpm", "f9da7547ffe15d84f880d4762c76661df5d5a5dd38d55860081e73921ac59fa3"},
|
||||||
|
|
Loading…
Reference in a new issue