Skip to content
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

Merged
merged 13 commits into from
Jun 7, 2024
Merged

feat: FDN-278 - SDKConfig Event #259

merged 13 commits into from
Jun 7, 2024

Conversation

JamieSinn
Copy link
Member

@JamieSinn JamieSinn commented Jun 3, 2024

No description provided.

Copy link

@sourcery-ai sourcery-ai bot left a 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

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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) {
Copy link

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.

Suggested change
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 {
Copy link

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.

Suggested change
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
}

@JamieSinn JamieSinn changed the title SDKConfig Event feat: FDN-278 - SDKConfig Event Jun 3, 2024
@@ -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
Copy link
Member

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?

Suggested change
return queueLength-startingLength >= 10
return ((queueLength - startingLength) >= 10)

Copy link
Member Author

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

@JamieSinn JamieSinn merged commit 6d7c11a into main Jun 7, 2024
8 checks passed
@JamieSinn JamieSinn deleted the go-sdkConfig branch June 7, 2024 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants