-
Notifications
You must be signed in to change notification settings - Fork 13
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
chore: add additional comments to code/structs, and sanity tests to verify functions are called within the expected context #151
Merged
jannfis
merged 1 commit into
argoproj-labs:main
from
jgwest:add-comments-to-repo-aug-2024
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ func (a *Agent) sender(stream eventstreamapi.EventStream_SubscribeClient) error | |
"direction": "Send", | ||
"client_addr": grpcutil.AddressFromContext(stream.Context()), | ||
}) | ||
|
||
q := a.queues.SendQ(a.remote.ClientID()) | ||
if q == nil { | ||
return fmt.Errorf("no send queue found for the remote principal") | ||
|
@@ -75,7 +76,7 @@ func (a *Agent) sender(stream eventstreamapi.EventStream_SubscribeClient) error | |
} | ||
logCtx.Tracef("Grabbed an item") | ||
if item == nil { | ||
// FIXME: Is this really the right thing to do? | ||
// TODO: Is this really the right thing to do? | ||
return nil | ||
} | ||
|
||
|
@@ -98,7 +99,7 @@ func (a *Agent) sender(stream eventstreamapi.EventStream_SubscribeClient) error | |
if grpcutil.NeedReconnectOnError(err) { | ||
return err | ||
} else { | ||
logCtx.Infof("Error while sending: %v", err) | ||
logCtx.Errorf("Error while sending: %v", err) | ||
return nil | ||
} | ||
} | ||
|
@@ -119,7 +120,7 @@ func (a *Agent) receiver(stream eventstreamapi.EventStream_SubscribeClient) erro | |
if grpcutil.NeedReconnectOnError(err) { | ||
return err | ||
} else { | ||
logCtx.Infof("Error while receiving: %v", err) | ||
logCtx.Errorf("Error while receiving: %v", err) | ||
return nil | ||
} | ||
} | ||
|
@@ -133,26 +134,6 @@ func (a *Agent) receiver(stream eventstreamapi.EventStream_SubscribeClient) erro | |
if err != nil { | ||
logCtx.WithError(err).Errorf("Unable to process incoming event") | ||
} | ||
// switch ev.Type() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code was moved into its own function which is called above, and is no longer needed. |
||
// case event.Create: | ||
// _, err := a.createApplication(incomingApp) | ||
// if err != nil { | ||
// logCtx.Errorf("Error creating application: %v", err) | ||
// } | ||
// case event.SpecUpdate: | ||
// _, err = a.updateApplication(incomingApp) | ||
// if err != nil { | ||
// logCtx.Errorf("Error updating application: %v", err) | ||
// } | ||
// case event.Delete: | ||
// err = a.deleteApplication(incomingApp) | ||
// if err != nil { | ||
// logCtx.Errorf("Error deleting application: %v", err) | ||
// } | ||
// default: | ||
// logCtx.Warnf("Received an unknown event: %s. Protocol mismatch?", ev.Type()) | ||
// } | ||
|
||
return nil | ||
} | ||
|
||
|
@@ -175,6 +156,7 @@ func (a *Agent) handleStreamEvents() error { | |
}) | ||
logCtx.Info("Starting to receive events from event stream") | ||
var err error | ||
// Continuously retrieve events from the event stream 'inbox' and process them, while the stream is connected | ||
for a.IsConnected() && err == nil { | ||
err = a.receiver(stream) | ||
if err != nil { | ||
|
@@ -194,6 +176,7 @@ func (a *Agent) handleStreamEvents() error { | |
}) | ||
logCtx.Info("Starting to send events to event stream") | ||
var err error | ||
// Continuously read events from the 'outbox', and send them to principal, while the stream is connected | ||
for a.IsConnected() && err == nil { | ||
err = a.sender(stream) | ||
if err != nil { | ||
|
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Changed
FIXME
toTODO
. This seemed to be the only instance ofFIXME
in the code. Happy to revert this part of the PR ifFIXME
was intentional.