-
Notifications
You must be signed in to change notification settings - Fork 8
fix: setProviderAndWait does not hang on ProviderError #88
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
Conversation
cb840b1 to
97efa1f
Compare
Signed-off-by: Fabrizio Demaria <fdema@spotify.com>
edd81d4 to
3f12d8d
Compare
| try { | ||
| provider.initialize(context) | ||
| } catch (e: Throwable) { | ||
| // This should never happen |
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.
Can we rephrase this to
This is not allowed to happen.
and maybe reference the spec?
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.
I don't think there is anything about this in the Spec. It's this specific implementation that expects the Provider to never throw and rather reads ProviderError events from the Provider.
The Java SDK, for example, works in the opposite way and expects the Provider to throw in case of errors
Signed-off-by: Fabrizio Demaria <fdema@spotify.com>
Signed-off-by: Fabrizio Demaria <fdema@spotify.com>
Signed-off-by: Fabrizio Demaria <fdema@spotify.com>
4b3de76 to
59f537f
Compare
| private var eventHandler = EventHandler(dispatcher) | ||
| override fun initialize(initialContext: EvaluationContext?) { | ||
| CoroutineScope(dispatcher).launch { | ||
| delay(10000) |
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.
nice!
This PR
setContextAndWaitshouldn't hang if the Provider fails the initalization phase for some reason.Related Issues
N/A
Follow-up Tasks
Similar logic will need to be added to setEvaluationContext
How to test
Added unit tests