Skip to content

Conversation

rasendubi
Copy link
Collaborator

No description provided.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was extracted from configurationstore.go without any changes

Copy link
Contributor

@aarsilv aarsilv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!

}, result)
}

func Test_Initialized_timeout(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌


go func() {
<-time.After(1 * time.Microsecond)
configurationStore.setConfiguration(configuration{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

timedOut = true
}

assert.False(t, timedOut)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +301 to +304
case <-client.Initialized():
timedOut = false
case <-time.After(1 * time.Millisecond):
timedOut = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to ChatGPT, this select block will wait for one of these two channels to complete, similar to JavaScript's Promise.race() 👌

@rasendubi rasendubi merged commit acb0960 into main Oct 17, 2024
3 checks passed
@rasendubi rasendubi deleted the ff-3380-wait-for-initialization branch October 17, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants