forked from datastax/python-driver
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit 1262d43
(minor improvement): small refactoring in NetworkTopologyStrategy's make_token_replica_map()
While trying to look at some random (flaky?) test (#510 (comment) )
I saw some (minor) improvements that can be made to NetworkTopologyStrategy's make_token_replica_map():
1. Remove some redundant len() calls to outside the loop(s)
2. Align some variable names, start with num_ ... for them.
3. Move token_offset and host assignment within the loop to closer to where it's used.
4. Only add DCs and hosts that are in the map
All those are probably very very minor improvements, perhaps in a large cluster it'll be noticable.
Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>1 parent 8acf8f9 commit 1262d43
1 file changed
+19
-17
lines changedLines changed: 19 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
629 | 629 |
| |
630 | 630 |
| |
631 | 631 |
| |
632 | - | ||
633 | - | ||
634 | - | ||
635 | - | ||
632 | + | ||
633 | + | ||
634 | + | ||
635 | + | ||
636 | + | ||
637 | + | ||
638 | + | ||
639 | + | ||
636 | 640 |
| |
637 | 641 |
| |
638 | 642 |
| |
| |||
644 | 648 |
| |
645 | 649 |
| |
646 | 650 |
| |
647 | - | ||
648 | - | ||
649 | 651 |
| |
650 | 652 |
| |
651 | 653 |
| |
| |||
657 | 659 |
| |
658 | 660 |
| |
659 | 661 |
| |
660 | - | ||
662 | + | ||
661 | 663 |
| |
662 | 664 |
| |
663 | - | ||
664 | - | ||
665 | + | ||
666 | + | ||
665 | 667 |
| |
666 | 668 |
| |
667 | - | ||
668 | - | ||
669 | + | ||
670 | + | ||
671 | + | ||
672 | + | ||
673 | + | ||
669 | 674 |
| |
670 | 675 |
| |
671 | 676 |
| |
672 | - | ||
673 | - | ||
674 | - | ||
675 | 677 |
| |
676 | 678 |
| |
677 | 679 |
| |
678 | - | ||
680 | + | ||
679 | 681 |
| |
680 | 682 |
| |
681 | 683 |
| |
682 | 684 |
| |
683 | - | ||
685 | + | ||
684 | 686 |
| |
685 | 687 |
| |
686 | 688 |
| |
687 | - | ||
689 | + | ||
688 | 690 |
| |
689 | 691 |
| |
690 | 692 |
| |
|
0 commit comments