-
Notifications
You must be signed in to change notification settings - Fork 175
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
[Execution] Randomize collection fetch order #3445
Conversation
93a7510
to
d15f56b
Compare
d15f56b
to
bfa8295
Compare
Why do we need uniform random here? |
The main reason for this randomness is to prevent the case scenario when we constantly request the same items over and over again because of the max batch size limit. |
I thought about that but doesn't flow-go/engine/common/requester/engine.go Line 306 in bfa8295
Sorry maybe asking too much (trying to grasp flow-go lately) but also why aborting here? flow-go/engine/common/requester/engine.go Line 339 in bfa8295
|
it would help sometimes depending on the phase of moon (timeouts, error rates, frequency of calling this function, etc.). It is better to explicitly randomize the order though.
It's a good question. The answer to it is: it was simpler: the complexity of this function is already too high. In reality we just need to refactor that piece of code to reduce complexity. |
Co-authored-by: Leo Zhang <zhangchiqing@gmail.com>
0afefbf
to
a1e475c
Compare
bors merge |
Map iteration order is not random, but instead undefined (as per go spec):
This does not mean random and especially not uniformly random. Therefore pre-randomize the order.