fix(helpers): prevent uniqueArray from hanging#2239
Conversation
… insufficient values to satisfy length
xDivisionByZerox
left a comment
There was a problem hiding this comment.
The implementation looks good. The failing pipeling seems to be unrelated to your changes. So I already approve 👍
Yea that codecov job is quite flaky and seems to fail every so often at random. |
|
Instead of reinventing the unique logic, shouldn't we reuse the unique method/logic? |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #2239 +/- ##
=======================================
Coverage 99.59% 99.59%
=======================================
Files 2639 2639
Lines 244720 244728 +8
Branches 1082 1081 -1
=======================================
+ Hits 243735 243744 +9
+ Misses 958 957 -1
Partials 27 27
|
I thought that was deprecated? |
|
Let's discuss this in the next team meeting. |
|
Team Decision We consider this a bandaid fix that solves the issue. |
fix #2207
Adds a max retry logic to uniqueArray.
I chose to use 1000*length rather than a fixed number of retries, as for example if you are
asking for a length of 2000, then 1000 retries would be insufficient.
This seems sufficient for most sensible use cases.
Obviously uniqueArray has no way to "know" how many unique values the function can return, you could define a function which returns "heads", "tails", but occasionally returns "edge" every 1000000 runs, or if the system date is a Thursday, etc etc.