Skip to content

Commit

Permalink
fix: delete process/global storage properly
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Sep 6, 2020
1 parent 863dba6 commit c75ae78
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/ash/dsl/extension.ex
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,17 @@ defmodule Ash.Dsl.Extension do
@extensions unquote(extensions)
# Due to a few strange stateful bugs I've seen,
# we clear the process of any potentially related state
Process.get()
|> Enum.filter(fn key ->
is_tuple(key) and elem(key, 0) == __MODULE__
end)
|> Enum.each(&Process.delete/1)
for {key, _value} <- Process.get() do
if is_tuple(key) and elem(key, 0) == __MODULE__ do
Process.delete(key)
end
end

:persistent_term.get()
|> Enum.filter(fn key ->
is_tuple(key) and elem(key, 0) == __MODULE__
end)
|> Enum.each(&:persistent_term.delete/1)
for {key, _value} <- :persistent_term.get() do
if is_tuple(key) and elem(key, 0) == __MODULE__ do
:persistent_term.erase(key)
end
end
end

imports =
Expand Down

0 comments on commit c75ae78

Please sign in to comment.