Skip to content

Commit

Permalink
Fix router introspection on big projects.
Browse files Browse the repository at this point in the history
  • Loading branch information
xward committed Jan 26, 2024
1 parent 6b24c96 commit 29781c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# PhoenixDDoS changelog

## 1.1.19

- fix: phoenix router instropection too slow on big projects

## 1.1.18

- fix: phoenix router instropection fail on module Hex.API
Expand Down
4 changes: 2 additions & 2 deletions lib/phoenix_ddos/core/configure.ex
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ defmodule PhoenixDDoS.Configure do
end

def phoenix_router?(module) when is_atom(module) do
case Code.ensure_loaded(module) do
{:module, module} -> function_exported?(module, :__routes__, 0)
case module |> inspect() |> String.contains?("Router") && Code.ensure_loaded?(module) do
true -> function_exported?(module, :__routes__, 0)
_ -> false
end
end
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule PhoenixDDoS.MixProject do
use Mix.Project

@version "1.1.18"
@version "1.1.19"
@source_url "https://github.com/xward/phoenix_ddos"

def project do
Expand Down

0 comments on commit 29781c8

Please sign in to comment.