Skip to content

Commit

Permalink
Release v2.19.4 (#634)
Browse files Browse the repository at this point in the history
* chore(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 in /demo (#621)

Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](jonschlinkert/word-wrap@1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: version bump to v2.19.3 (#631)

* fix: more debug tools (#633)

* fix: console more channel errors for Inspector

* fix: log handle_info messages if log_level is `:info`

* fix: bump version

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wen Bo Xie <[email protected]>
  • Loading branch information
3 people authored Aug 15, 2023
1 parent 938cf35 commit e397249
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
5 changes: 3 additions & 2 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Hooks.payload = {
);

// Finally, subscribe to the Channel we just setup
this.channel.subscribe(async (status) => {
this.channel.subscribe(async (status, error) => {
if (status === "SUBSCRIBED") {
console.log(`Realtime Channel status: ${status}`);

Expand Down Expand Up @@ -159,7 +159,8 @@ Hooks.payload = {
payload: { name: name, t: performance.now() },
});
} else {
console.log(`Realtime Channel status: ${status}`);
console.error(`Realtime Channel error status: ${status}`);
console.error(`Realtime Channel error: ${error}`);
}
});
},
Expand Down
12 changes: 6 additions & 6 deletions demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 20 additions & 6 deletions lib/realtime_web/channels/realtime_channel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ defmodule RealtimeWeb.RealtimeChannel do
end

@impl true
def handle_info(:sync_presence, %{assigns: %{tenant_topic: topic}} = socket) do
socket = count(socket)
def handle_info(:sync_presence = msg, %{assigns: %{tenant_topic: topic}} = socket) do
socket = socket |> count() |> maybe_log_handle_info(msg)

push(socket, "presence_state", presence_dirty_list(topic))

Expand All @@ -248,8 +248,8 @@ defmodule RealtimeWeb.RealtimeChannel do
end

@impl true
def handle_info(%{event: type, payload: payload}, socket) do
socket = count(socket)
def handle_info(%{event: type, payload: payload} = msg, socket) do
socket = socket |> count() |> maybe_log_handle_info(msg)

push(socket, type, payload)
{:noreply, socket}
Expand Down Expand Up @@ -320,8 +320,8 @@ defmodule RealtimeWeb.RealtimeChannel do
end
end

def handle_info(other, socket) do
Logger.error("Undefined msg #{inspect(other, pretty: true)}")
def handle_info(msg, socket) do
Logger.error("HANDLE_INFO message not handled: #{inspect(msg, pretty: true)}")
{:noreply, socket}
end

Expand Down Expand Up @@ -560,6 +560,20 @@ defmodule RealtimeWeb.RealtimeChannel do
assign(socket, :rate_counter, rate_counter)
end

defp maybe_log_handle_info(
%{assigns: %{log_level: log_level, channel_name: channel_name}} = socket,
msg
) do
if Logger.compare_levels(log_level, :error) == :lt,
do:
Logger.log(
log_level,
"HANDLE_INFO INCOMING ON " <> channel_name <> " message: " <> inspect(msg)
)

socket
end

defp presence_key(params) do
with key when is_binary(key) <- params["config"]["presence"]["key"],
true <- String.length(key) > 0 do
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Realtime.MixProject do
def project do
[
app: :realtime,
version: "2.19.2",
version: "2.19.4",
elixir: "~> 1.14.0",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit e397249

Please sign in to comment.