Closed delannoyk closed 3 years ago
Hi @delannoyk thanks for submitting this PR! We will review this internally to check if this fits with intended SDK behavior.
Hi @delannoyk,
While our SDK team hasn't yet had a chance to look at this issue, I did want to recommend that you use smaller intervals if you haven't already done so. Our SDK isn't really designed to operate with "really long" intervals because, depending on which intervals you extends, flag values will be stale (which is actually your intent here) and the event buffer is more likely to overflow and start dropping events.
If you choose to proceed with large intervals, consider setting them to the max int value so as to avoid running into this crash.
Cheers, @bwoskow-ld
Thanks again for the contribution! It's been included in the 5.4.2 release.
Thanks, @gwhelanLD
Thank you for the update 👍🏻
Requirements
Related issues
I didn't create a GitHub issue for this, but happy to if necessary.
Describe the solution you've provided
Int(exactly:)
will return nil in case of an overflow whereasInt(_:)
will just crash. When converting theDouble
to anInt
, if it fails, we now useInt.max
as a rescue.Describe alternatives you've considered
Fixing the crash was I think necessary. That being said, we only noticed that crash because we wanted to disable updates to our feature flags during a user session (we want to have a consistent experience throughout the session). There's no way that I could find to do that right now, so we opted for having a really long update interval. Adding this feature would have been nice too, but was more work that I intended.
Additional context
Nothing else from me.