-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: FDN-278 - SDKConfig Event #259
Conversation
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.
Hey @JamieSinn - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -434,12 +436,34 @@ func TestClient_Validate_OnInitializedChannel_EnableCloudBucketing_Options(t *te | |||
t.Fatal("Expected config to be loaded") | |||
} | |||
} | |||
func TestClient_ConfigUpdatedEvent(t *testing.T) { |
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.
suggestion: Consider adding a comment to explain the purpose of this test.
Adding a brief comment at the beginning of the test function can help future maintainers understand the purpose and context of this test.
func TestClient_ConfigUpdatedEvent(t *testing.T) { | |
func TestClient_ConfigUpdatedEvent(t *testing.T) { | |
// Test to ensure the client correctly handles configuration update events |
@@ -113,6 +115,30 @@ func (e *EventManager) QueueVariableDefaultedEvent(variableKey string, defaultRe | |||
return e.internalQueue.QueueVariableDefaulted(variableKey, defaultReason) | |||
} | |||
|
|||
func (e *EventManager) QueueSDKConfigEvent(req http.Request, resp http.Response) error { |
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.
suggestion: Consider handling potential errors from QueueEvent
.
Even though the comment mentions that it's best effort, logging the error might be useful for debugging purposes.
func (e *EventManager) QueueSDKConfigEvent(req http.Request, resp http.Response) error { | |
func (e *EventManager) QueueSDKConfigEvent(req http.Request, resp http.Response) error { | |
uuid := e.GetUUID() | |
user := api.User{UserId: uuid} | |
err := e.internalQueue.QueueVariableDefaulted(variableKey, defaultReason) | |
if err != nil { | |
log.Printf("Error queuing SDK config event: %v", err) | |
} | |
return err | |
} |
event_manager_test.go
Outdated
@@ -76,7 +77,7 @@ func TestEventManager_QueueEvent_100_Flush(t *testing.T) { | |||
// Wait for raw event queue to drain | |||
require.Eventually(t, func() bool { | |||
queueLength, _ := c.eventQueue.internalQueue.UserQueueLength() | |||
return queueLength == 10 | |||
return queueLength-startingLength >= 10 |
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.
what is the OOO here?
return queueLength-startingLength >= 10 | |
return ((queueLength - startingLength) >= 10) |
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.
Forgot to remove - this is from testing
No description provided.