-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Use plain socket objects instead of wrapper classes #3127
base: master
Are you sure you want to change the base?
Conversation
e4a2331
to
bb6c318
Compare
Refactor socket creation to remove the socket wrapper classes so that these objects have less surprising behavior when used in worker hooks, worker classes, and custom applications. Close #3013.
bb6c318
to
a24ff07
Compare
is there anything else missing for this? |
@benoitc polite bump, if you have the time |
if i < 5: | ||
msg = "connection to {addr} failed: {error}" | ||
log.debug(msg.format(addr=str(addr), error=str(e))) | ||
log.error("Retrying in 1 second.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pajod what's your idea there?
@tilgovi is this ready for review or do yui think to any other addition/changes already? |
@tilgovi What is the status of your PR? |
gunicorn/sock.py
Outdated
# first initialization of gunicorn | ||
old_umask = os.umask(conf.umask) | ||
try: | ||
for addr in [bind for bind in conf.address if not isinstance(bind, int)]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this part more readable. I would create the bind list in a separate line there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does my PR work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tilgovi can you handle the change there. Otherwise I think it's OK for merge.
Implementing suggestion by reviewer #3127 (comment) to make code more readable.
Should the monkey patching in I was able to run my WIP request after reloading test against your PR after fixing just the following variable access: - sockets.append(socket.socket(s.FAMILY, socket.SOCK_STREAM,
- fileno=s.sock.fileno()))
+ sockets.append(socket.socket(s.family, socket.SOCK_STREAM,
+ fileno=s.fileno())) EDIT: rebased a24ff07 - including the above fix here: |
Update sock.py by making bind list creation more readable
commit e4b5d48 Merge: a24ff07 ec52843 Author: Benoit Chesneau <bchesneau@gmail.com> Date: Sat Aug 10 10:23:20 2024 +0200 Merge pull request benoitc#3188 from tnusser/patch-1 Update sock.py by making bind list creation more readable commit ec52843 Author: Tobias Nusser <tobiasnusser@web.de> Date: Wed Apr 17 12:48:26 2024 +0200 Update sock.py by making bind list creation more readable Implementing suggestion by reviewer benoitc#3127 (comment) to make code more readable. commit a24ff07 Author: Randall Leeds <randall@bleeds.info> Date: Thu Dec 28 00:57:50 2023 -0800 Use plain socket objects instead of wrapper classes Refactor socket creation to remove the socket wrapper classes so that these objects have less surprising behavior when used in worker hooks, worker classes, and custom applications. Close benoitc#3013.
Refactor socket creation to remove the socket wrapper classes so that these objects have less surprising behavior when used in worker hooks, worker classes, and custom applications.
Close #3013.