projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cb06e98
)
Websocket handler: do not raise if handler is terminated before switching protocols
author
rinpatch
<rinpatch@sdf.org>
Thu, 10 Sep 2020 10:48:24 +0000
(13:48 +0300)
committer
rinpatch
<rinpatch@sdf.org>
Thu, 10 Sep 2020 18:14:23 +0000
(21:14 +0300)
Closes #2131
lib/pleroma/web/mastodon_api/websocket_handler.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/web/mastodon_api/websocket_handler.ex
b/lib/pleroma/web/mastodon_api/websocket_handler.ex
index e6010bb4a31f3ecc296439890150f7d1fdc63748..5090d96221c271a055585b61d1ce8ff76e5ab878 100644
(file)
--- a/
lib/pleroma/web/mastodon_api/websocket_handler.ex
+++ b/
lib/pleroma/web/mastodon_api/websocket_handler.ex
@@
-100,6
+100,10
@@
defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
{:reply, :ping, %{state | timer: nil, count: 0}, :hibernate}
end
+ # State can be `[]` only in case we terminate before switching to websocket,
+ # we already log errors for these cases in `init/1`, so just do nothing here
+ def terminate(_reason, _req, []), do: :ok
+
def terminate(reason, _req, state) do
Logger.debug(
"#{__MODULE__} terminating websocket connection for user #{