-
Notifications
You must be signed in to change notification settings - Fork 20
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
Refactor commands #644
Merged
Merged
Refactor commands #644
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Overview
Packages and Vulnerabilities (6 package changes and 1 vulnerability changes)
Changes for packages of type
|
Package | Versionghcr.io/gatewayd-io/gatewayd:5d9801f |
Versiongatewaydio/gatewayd:latest |
|
---|---|---|---|
➖ | ca-certificates | 20240705-r0 |
|
➖ | openssl | 3.3.2-r0 |
|
➖ | pax-utils | 1.3.7-r2 |
Signed-off-by: Mostafa Moradian <mostafa@gatewayd.io>
Use a global app variable for test only and assign it only in tests Add stopGracefully as a method to the GatewayDInstance struct Move signal handler to the top to avoid half-states on exit Add a new function for creating an instance of GatewayDInstance using parsed flags
Closed
Graceful shutdown of gRPC server
sinadarbouy
pushed a commit
that referenced
this pull request
Feb 18, 2025
* Refactor global variables into a global struct * Update tests * Use param instead of global variable * Update tests * Fix formatting * Add a hack to fix the tests * Ignore raft files * Fix tests * Remove global variables * Use a global app variable for test only and assign it only in tests * Add stopGracefully as a method to the GatewayDInstance struct * Move signal handler to the top to avoid half-states on exit * Add a new function for creating an instance of GatewayDInstance using parsed flags * Remove duplicate internal functions * Update tests * Use exported functions instead of internal variables * Remove global variables * Update tests * Fix linter error * Ignore dupl linter * Fix tests with the actual log output * Clean up after test * Remove global variables * Skip path slip verification * Fix tests * Remove backup * Another try to fix the test * Fix missing/unknown behavior * Add a pull-only test * Declare variable before assignment * Fix plugin install behavior * Fix plugin install with no overwrite * Revert changes * Rename variable * Use filepath to join paths * Remove unnecessary file * Ignore plugins file if exists * Remove duplicate code * Reset the pull-only flag * Check if the server is properly closed before erroring out * Refactor run command into a separate file * Fix bug in handling early exit * Move left-over functions * Add comments * Fix linter errors * Fix missing log message and span * Handle errors when stopping the listener for gRPC server * Graceful shutdown of gRPC server * Revert changes to path * Use local variable * Replace all context.TODO with context.Background * Split exit codes into a separate file * Remove unused constant and renumber others * Use exported function instead of internal variables * Ignore linter errors * Rename variable and comment to match the behavior
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ticket(s)
Fixes #324
Fixes #370
Description
In this PR, I removed global variables in favor of encapsulation within a struct that is initialized locally. Almost all functions now receive parameters instead of relying on those global variables, which improves maintainability. I refactored the
run
command and broken it down into procedural methods within theGatewayDApp
struct. The functionality remained the same. I added a few tests and improved the existing ones by removing reliance on global variables. I refactored other commands as well. The flags are now processed inside the command'sRun
function, instead of updating global variables, which caused many issues in tests.Related PRs
N/A
Development Checklist
make gen-docs
command.addedupdated tests for my changes.Legal Checklist