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

[Socket Draining] Dynamic socket drainer configuration #5543

Merged

Conversation

studzien
Copy link
Contributor

@studzien studzien commented Aug 8, 2023

To configure the socket drainer, one must currently set it up during the compile time. I suggest adding an option to pass {M, F, A} to return the drainer configuration keyword list, just like the check_origin option. This would allow for runtime configuration of the drainer.

However, I could not find any tests related to this feature.

@studzien
Copy link
Contributor Author

Hi @josevalim 👋
Since you worked on the socket draining, would you be interested in looking at this PR?
Thank you!

@josevalim
Copy link
Member

Couldn't you configure it on config/runtime.exs with dynamic values?

@studzien
Copy link
Contributor Author

studzien commented Aug 24, 2023

The drainer can be configured at compile-time using socket in the endpoint. Is there a way to configure it dynamically? I couldn't find a way to do this, so I assumed that's why check_origin and connection_info.session can be configured via MFAs.

@josevalim
Copy link
Member

You are right. I thought this was about the endpoint drainer, not the socket one. :)

@josevalim
Copy link
Member

Can you please add a test?

@studzien
Copy link
Contributor Author

studzien commented Aug 24, 2023

Sure! I tried to cover all cases, including static config and :ignore, in test/phoenix/socket/socket_test.exs. However, I am uncertain if that is the most appropriate location.

@josevalim josevalim merged commit deea9d6 into phoenixframework:main Aug 24, 2023
4 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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

Successfully merging this pull request may close these issues.

2 participants