• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supavisor / e5e7ebfe80dbec4965226225050d4ef5c8216e88-PR-605

21 Feb 2025 02:35PM UTC coverage: 45.973% (-0.03%) from 46.003%
e5e7ebfe80dbec4965226225050d4ef5c8216e88-PR-605

Pull #605

github

hauleth
fix: remaining SSL connections that need to set `verify_none` option
Pull Request #605: fix: remaining SSL connections that need to set `verify_none` option

2 of 9 new or added lines in 3 files covered. (22.22%)

267 existing lines in 26 files now uncovered.

959 of 2086 relevant lines covered (45.97%)

635.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.82
/lib/supavisor/syn_handler.ex
1
defmodule Supavisor.SynHandler do
2
  @moduledoc """
3
  Custom defined Syn's callbacks
4
  """
5

6
  @behaviour :syn_event_handler
7

8
  require Logger
9

10
  @impl true
11
  def on_process_unregistered(
12
        :tenants,
13
        {{type, tenant}, user, mode, db_name, _search_path} = id,
14
        _pid,
15
        meta,
16
        reason
17
      ) do
18
    metadata = %{
14✔
19
      project: tenant,
20
      user: user,
21
      mode: mode,
22
      db_name: db_name,
23
      type: type
24
    }
25

26
    Logger.debug("Process unregistered: #{inspect(id)} #{inspect(reason)}", metadata)
14✔
27

28
    case meta do
14✔
29
      %{port: port, listener: listener} ->
30
        try do
14✔
31
          :ranch.stop_listener(id)
14✔
32

33
          Logger.notice(
12✔
34
            "SynHandler: Stopped listener #{inspect(id)} on port #{inspect(port)} listener #{inspect(listener)}",
35
            metadata
36
          )
37
        rescue
UNCOV
38
          exception ->
2✔
UNCOV
39
            Logger.notice(
2✔
UNCOV
40
              "ListenerShutdownError: Failed to stop listener #{inspect(id)} #{Exception.message(exception)}",
2✔
41
              metadata
42
            )
43
        end
44

45
      _ ->
×
46
        nil
47
    end
48
  end
49

50
  @impl true
51
  def resolve_registry_conflict(
52
        :tenants,
53
        id,
54
        {pid1, _, time1},
55
        {pid2, _, time2}
56
      ) do
UNCOV
57
    {keep, stop} =
1✔
UNCOV
58
      if time1 < time2 do
1✔
59
        {pid1, pid2}
60
      else
61
        {pid2, pid1}
62
      end
63

UNCOV
64
    if node() == node(stop) do
1✔
UNCOV
65
      spawn(fn ->
1✔
UNCOV
66
        resp =
1✔
67
          if Process.alive?(stop) do
×
UNCOV
68
            try do
1✔
UNCOV
69
              Supervisor.stop(stop, :shutdown, 30_000)
1✔
70
            catch
71
              error, reason -> {:error, {error, reason}}
×
72
            end
73
          else
74
            :not_alive
75
          end
76

UNCOV
77
        Logger.warning(
1✔
78
          "SynHandler: Resolving #{inspect(id)} conflict, stop local pid: #{inspect(stop)}, response: #{inspect(resp)}"
79
        )
80
      end)
81
    else
82
      Logger.warning(
×
83
        "SynHandler: Resolving #{inspect(id)} conflict, remote pid: #{inspect(stop)}"
84
      )
85
    end
86

UNCOV
87
    keep
1✔
88
  end
89
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc