Skip to content

Conversation

@johnnyshields
Copy link
Contributor

@johnnyshields johnnyshields commented Jan 10, 2022

This PR refactors Launcher#run to increase code readability. It does not change any logic or ordering of operations.

Reason: When reading the code of Launcher, initially it wasn't obvious to me how the @status variable was used. This makes the control flow much more obvious.

Things to watch out for:

  • I added methods do_run_finished, do_graceful_stop, etc. I'm happy to name these methods something other than do_xxx
  • I've removed the # do nothing condition for @status == :exit. Not only is there no need to have a # do nothing condition for it, it doesn't appear @status = :exit is actually set anywhere in Puma.

… does not change any logic or ordering of operations.
@johnnyshields johnnyshields changed the title Refactor Launcher#run to increase readability Refactor Launcher#run to increase readability (no logic change) Jan 10, 2022
@johnnyshields johnnyshields force-pushed the refactor-launcher-run-finished branch from 5c11ca7 to d99227e Compare January 10, 2022 07:16
@nateberkopec
Copy link
Member

Loving all the contributions @johnnyshields

@nateberkopec nateberkopec added refactor waiting-for-review Waiting on review from anyone labels Jan 10, 2022
@johnnyshields
Copy link
Contributor Author

johnnyshields commented Jan 11, 2022

@nateberkopec by the way, I'm working on porting the Launcher + worker forking code from Puma to DelayedJob (with attribution of course). PR is here: collectiveidea/delayed_job#1160. Having copy-on-write will save me roughly $10,000 / month on my AWS bill, I'm currently memory-bound on my workloads.

@nateberkopec nateberkopec merged commit 3dfabf6 into puma:master Jan 31, 2022
JuanitoFatas pushed a commit to JuanitoFatas/puma that referenced this pull request Sep 9, 2022
…#2795)

* Breaks Launcher#run into more functions to increase readability. This does not change any logic or ordering of operations.

* Fix specs

* More terse comment

Co-authored-by: shields <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor waiting-for-review Waiting on review from anyone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants