aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2019-02-28 16:23:24 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2019-02-28 16:23:24 +0000
commit388a3f4ca2299faca366f6dc19485dc03c307aa5 (patch)
treee623c3789a51a58f6be161ce052aedeb052c7773
parentf1d37a5e2399d06c8a2178c98825e77e5b381460 (diff)
downloadpleroma-388a3f4ca2299faca366f6dc19485dc03c307aa5.tar.gz
mastodon websocket: bring back infinity timeout
-rw-r--r--lib/pleroma/web/mastodon_api/websocket_handler.ex7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/websocket_handler.ex b/lib/pleroma/web/mastodon_api/websocket_handler.ex
index edab961f0..bb7ecad69 100644
--- a/lib/pleroma/web/mastodon_api/websocket_handler.ex
+++ b/lib/pleroma/web/mastodon_api/websocket_handler.ex
@@ -23,13 +23,16 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
]
@anonymous_streams ["public", "public:local", "hashtag"]
- def init(%{qs: qs} = req, _state) do
+ # Handled by periodic keepalive in Pleroma.Web.Streamer.
+ @timeout :infinity
+
+ def init(%{qs: qs} = req, state) do
with params <- :cow_qs.parse_qs(qs),
access_token <- List.keyfind(params, "access_token", 0),
{_, stream} <- List.keyfind(params, "stream", 0),
{:ok, user} <- allow_request(stream, access_token),
topic when is_binary(topic) <- expand_topic(stream, params) do
- {:cowboy_websocket, req, %{user: user, topic: topic}}
+ {:cowboy_websocket, req, %{user: user, topic: topic}, %{idle_timeout: @timeout}}
else
{:error, code} ->
Logger.debug("#{__MODULE__} denied connection: #{inspect(code)} - #{inspect(req)}")