CXXCBC-284: Use round-robin for config polling#504
Conversation
Instead of letting each MCBP session to poll for configuration automatically, make bucket object responsible for the polling orchestration and iterate over the list of known session to use only one socket to fetch configuration.
|
Doesn't the RFC say to have a random list and then iterate through it so we don't have a stampeding herd if there's a network issue? |
| do { | ||
| auto ptr = sessions_.find(i % sessions_.size()); | ||
| if (ptr != sessions_.end() && ptr->second.supports_gcccp()) { | ||
| session = ptr->second; |
There was a problem hiding this comment.
should this break out of the while loop? Otherwise the only exit condition for the loop is that we have reached the beginning again.
} while (start % sessions_.size() != i % sessions_.size());
|
the "SHOULD" leaves a little wiggle room. But I looked again at the code, and it looks like the do/while is missing an an exit condition (other than checking all the possible sessions). It looks like it will always choose the last one it checks (?). "The SDK MUST perform these connections sequentially and not in parallel, and SHOULD perform this in a consistently random order (the SDK should pre-shuffle the list, and then use the pre-shuffled order consistently). " |
|
Thanks for checking, sounds like we should file anew or reopen that issue @mikereiche? |
Instead of letting each MCBP session to poll for configuration automatically, make bucket object responsible for the polling orchestration and iterate over the list of known session to use only one socket to fetch configuration.