Skip to content

Commit

Permalink
0.1.4 Version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
merqlove committed Jul 28, 2016
1 parent 4b6baef commit a154b01
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
20 changes: 9 additions & 11 deletions lib/redix/pubsub/fastlane/server.ex
Expand Up @@ -110,11 +110,6 @@ defmodule Redix.PubSub.Fastlane.Server do
{:noreply, %{ state | connected: false }}
end

def handle_cast({:punsubscribe, [pattern], _}, state) do
IO.inspect pattern
{:noreply, %{ state | connected: false }}
end

def handle_info({:redix_pubsub, redix_pid, operation, _}, %{redix_pid: redix_pid} = state) when operation in @subscribed_callbacks do
{:noreply, state}
end
Expand Down Expand Up @@ -150,19 +145,22 @@ defmodule Redix.PubSub.Fastlane.Server do
defp _notify_all(subscribers, message, state) do
payload = exclude_ns(message, state)

if is_nil(state.fastlane) do
_notify_all_embed(subscribers, payload)
else
state.fastlane.fastlane(subscribers, payload)
end
end

defp _notify_all_embed(subscribers, message) do
subscribers
|> Enum.each(fn
{_from, %{pid: pid, options: options, parent: parent}} ->
_notify(pid, parent, payload, options, state.fastlane)
parent.fastlane(pid, message, options)
_ -> :noop
end)
end

def _notify(pid, parent, payload, options, default_fastlane) do
module = parent || default_fastlane
module.fastlane(pid, payload, options)
end

defp _find(channels, channel, from) do
subscriptions =
:ets.lookup(channels, channel)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Expand Up @@ -2,7 +2,7 @@ defmodule RedixPubsubFastlane.Mixfile do
use Mix.Project

@project_url "https://github.com/merqlove/redix_pubsub_fastlane"
@version "0.1.3"
@version "0.1.4"

def project do
[app: :redix_pubsub_fastlane,
Expand Down
9 changes: 9 additions & 0 deletions test/support/redix/pubsub/fastlane/namespace_test.exs
Expand Up @@ -11,6 +11,15 @@ defmodule Redix.PubSub.Fastlane.NamespaceTest do
GenServer.cast(pid, :stop)
end

def fastlane(subscribers, message) do
subscribers
|> Enum.each(fn
{_from, %{pid: pid, options: options, parent: parent}} ->
__MODULE__.fastlane(pid, message, options)
_ -> :noop
end)
end

def fastlane(pid, payload, options) do
GenServer.cast({FastlaneTestNamespace, node()}, {:fastlane, pid, payload, options})
:ok
Expand Down

0 comments on commit a154b01

Please sign in to comment.