Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store less information in the registry #1261

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions lib/absinthe/subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,32 @@
}
}

pdict_add_field(doc_id, field_key)
{:ok, _} = Registry.register(registry, field_key, doc_value)
{:ok, _} = Registry.register(registry, {self(), doc_id}, field_key)
end

defp pdict_fields(doc_id) do
Process.get({__MODULE__, doc_id}, [])
end

defp pdict_add_field(doc_id, field) do
Process.put({__MODULE__, doc_id}, [field | pdict_fields(doc_id)])
end

defp pdict_delete_fields(doc_id) do
Process.delete({__MODULE__, doc_id})
end

@doc false
def unsubscribe(pubsub, doc_id) do
registry = pubsub |> registry_name
self = self()

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.13 / OTP 24

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.13 / OTP 24

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.13 / OTP 25

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.13 / OTP 25

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.14 / OTP 24

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.14 / OTP 24

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.14 / OTP 25

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.14 / OTP 25

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.15 / OTP 24

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.15 / OTP 24

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.15 / OTP 24

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.15 / OTP 25

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.15 / OTP 25

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.15 / OTP 25

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.15 / OTP 26

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.15 / OTP 26

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 173 in lib/absinthe/subscription.ex

View workflow job for this annotation

GitHub Actions / Elixir 1.15 / OTP 26

variable "self" is unused (if the variable is not meant to be used, prefix it with an underscore)
benwilson512 marked this conversation as resolved.
Show resolved Hide resolved

for {^self, field_key} <- Registry.lookup(registry, {self, doc_id}) do
for field_key <- pdict_fields(doc_id) do
Registry.unregister_match(registry, field_key, {doc_id, :_})
end

Registry.unregister(registry, {self, doc_id})
pdict_delete_fields(doc_id)
:ok
end

Expand Down
Loading