Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:fullsweep_after option is ignored #5573

Closed
zookzook opened this issue Sep 6, 2023 · 3 comments
Closed

:fullsweep_after option is ignored #5573

zookzook opened this issue Sep 6, 2023 · 3 comments

Comments

@zookzook
Copy link

zookzook commented Sep 6, 2023

Environment

  • Elixir version (elixir -v): Elixir 1.15.4
  • Phoenix version (mix deps): 1.6.16
  • Operating system: Mac OS X

Actual behavior

From the documents, it is possible to set the :fullsweep_after option in the web sockets part of the endpoint configuration.

defmodule Web.Endpoint do
  use Phoenix.Endpoint, otp_app: :web
  
  socket "/socket", OnsenWeb.UserSocket,
    websocket: [fullsweep_after: 20],
    longpoll: false

It seems after using the WebSock package it does not work anymore.
See 623ea99

My workaround is to set the process flags right in the init/1 function of my user socket module like this:

defmodule Web.UserSocket do
  use Phoenix.Socket
  
  ...
  
  @impl true
  def init(state) do
    res = {:ok, {_, socket}} = super(state)
    :erlang.process_flag(:fullsweep_after, 20)
    res
  end

Expected behavior

Either the documentation must be adjusted, or the :fullsweep_after option must be reused in the code. By using the workaround I can verify that the value of the :fullsweep_after option changed to the desired value of the web socket process (initial call :cowboy_clear.connection_process/4).

@zookzook
Copy link
Author

zookzook commented Sep 6, 2023

Thank you for your fast response. I think I will update to the latest version first and try it again. I'm closing the issue.

@zookzook zookzook closed this as completed Sep 6, 2023
@zookzook
Copy link
Author

zookzook commented Sep 7, 2023

After updating Phoenix to the latest version it works as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants