-
Notifications
You must be signed in to change notification settings - Fork 19
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 proxy.shouldTerminate
function and move the functionality to Act.Registry
#615
Conversation
… Act.Registry Simplify syntax and avoid unnecessary loops (using maps.Keys) Create RunAll and ShouldTerminate functions in Act.Registry
Overview
Packages and Vulnerabilities (5 package changes and 0 vulnerability changes)
Changes for packages of type
|
Package | Versionghcr.io/gatewayd-io/gatewayd:f76cd2b |
Versiongatewaydio/gatewayd:latest |
|
---|---|---|---|
➖ | ca-certificates | 20240705-r0 |
|
➖ | openssl | 3.3.2-r0 |
|
➖ | pax-utils | 1.3.7-r2 |
Changes for packages of type golang
(2 changes)
Package | Versionghcr.io/gatewayd-io/gatewayd:f76cd2b |
Versiongatewaydio/gatewayd:latest |
|
---|---|---|---|
♾️ | github.com/gatewayd-io/gatewayd | (devel) |
0.9.8 |
♾️ | stdlib | go1.23.2 |
1.23.1 |
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.
All of the review comments are minor and can be skipped if needed, LGTM
act/registry.go
Outdated
_, ok := result[sdkAct.Terminal] | ||
return ok && cast.ToBool(result[sdkAct.Terminal]) |
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.
Nit:
Avoids casting if the key doesn’t exist
Improved type safety with the use of ok checks
_, ok := result[sdkAct.Terminal] | |
return ok && cast.ToBool(result[sdkAct.Terminal]) | |
terminalVal, exists := result[sdkAct.Terminal] | |
if !exists { | |
r.Logger.Debug().Msg("'__Terminal__' key not found, request will continue.") | |
return false | |
} | |
shouldTerminate, ok := cast.TryBool(terminalVal) | |
if !ok { | |
r.Logger.Warn().Msg("'__Terminal__' key exists but cannot be cast to a boolean.") | |
return false | |
} | |
if shouldTerminate { | |
r.Logger.Info().Msg("Request is marked as terminal. Terminating.") | |
} | |
return shouldTerminate |
@sinadarbouy Thanks for the review. I addressed the comments. |
Ticket(s)
Related to #397.
Description
This refactoring is the preliminary work to enable processing of notification hooks and in turn let plugins publish actions via notification hooks.
Related PRs
N/A
Development Checklist
make gen-docs
command.Legal Checklist