Skip to content

Commit

Permalink
Revert "Configure sweeper interval in minutes"
Browse files Browse the repository at this point in the history
This reverts commit f27a470.
  • Loading branch information
RichDom2185 committed Sep 17, 2023
1 parent 9f6e5b8 commit 23ad329
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions lib/guardian/db/sweeper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ defmodule Guardian.DB.Sweeper do

alias Guardian.DB.Token

@sixty_minutes 60
@sixty_minutes 60 * 60 * 1000

def start_link(opts) do
interval = Keyword.get(opts, :interval, @sixty_minutes) |> minute_to_ms()
interval = Keyword.get(opts, :interval, @sixty_minutes)
GenServer.start_link(__MODULE__, [interval: interval], name: __MODULE__)
end

Expand Down Expand Up @@ -72,13 +72,4 @@ defmodule Guardian.DB.Sweeper do

[interval: interval, timer: timer]
end

defp minute_to_ms(value) when is_binary(value) do
value
|> String.to_integer()
|> minute_to_ms()
end

defp minute_to_ms(value) when value < 1, do: 1000
defp minute_to_ms(value), do: round(value * 60 * 1000)
end

0 comments on commit 23ad329

Please sign in to comment.