Compare commits
No commits in common. "f66135ed0819248e65c7c872fe9cb2122e09fb1b" and "dc34328f151009c56b8f27191be4416ecad93472" have entirely different histories.
f66135ed08
...
dc34328f15
1 changed files with 0 additions and 6 deletions
|
@ -18,8 +18,6 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
|
||||||
@timeout :timer.seconds(60)
|
@timeout :timer.seconds(60)
|
||||||
# Hibernate every X messages
|
# Hibernate every X messages
|
||||||
@hibernate_every 100
|
@hibernate_every 100
|
||||||
# Tune garabge collect for long-lived websocket process
|
|
||||||
@fullsweep_after 20
|
|
||||||
|
|
||||||
def init(%{qs: qs} = req, state) do
|
def init(%{qs: qs} = req, state) do
|
||||||
with params <- Enum.into(:cow_qs.parse_qs(qs), %{}),
|
with params <- Enum.into(:cow_qs.parse_qs(qs), %{}),
|
||||||
|
@ -61,10 +59,6 @@ def websocket_init(state) do
|
||||||
"#{__MODULE__} accepted websocket connection for user #{(state.user || %{id: "anonymous"}).id}, topic #{state.topic}"
|
"#{__MODULE__} accepted websocket connection for user #{(state.user || %{id: "anonymous"}).id}, topic #{state.topic}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# process is long-lived and can sometimes accumulate stale data in such a way it's
|
|
||||||
# not freed by young garbage cycles, thus make full collection sweeps more frequent
|
|
||||||
:erlang.process_flag(:fullsweep_after, @fullsweep_after)
|
|
||||||
|
|
||||||
Streamer.add_socket(state.topic, state.oauth_token)
|
Streamer.add_socket(state.topic, state.oauth_token)
|
||||||
{:ok, %{state | timer: timer()}}
|
{:ok, %{state | timer: timer()}}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue